workers-runtime-sdk 1.4.2__tar.gz → 1.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (17) hide show
  1. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/CHANGELOG.md +25 -0
  2. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/PKG-INFO +1 -1
  3. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/pyproject.toml +1 -1
  4. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/src/workers/_workers.py +35 -5
  5. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/.gitignore +0 -0
  6. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/AGENTS.md +0 -0
  7. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/README.md +0 -0
  8. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/src/_cloudflare_compat_flags.pyi +0 -0
  9. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/src/_pyodide_entrypoint_helper.pyi +0 -0
  10. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/src/_workers_sdk_entropy_import_context.pth +0 -0
  11. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/src/_workers_sdk_entropy_import_context.py +0 -0
  12. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/src/_workers_sdk_entropy_import_context_loader.py +0 -0
  13. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/src/asgi.py +0 -0
  14. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/src/workers/__init__.py +0 -0
  15. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/src/workers/py.typed +0 -0
  16. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/src/workers/workflows.py +0 -0
  17. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.5.0}/uv.lock +0 -0
@@ -2,6 +2,31 @@
2
2
 
3
3
  <!-- version list -->
4
4
 
5
+ ## v1.5.0 (2026-06-23)
6
+
7
+ ### Features
8
+
9
+ - Apply bindings wrapper to AI bindings ([#130](https://github.com/cloudflare/workers-py/pull/130),
10
+ [`79eeaf9`](https://github.com/cloudflare/workers-py/commit/79eeaf94ab02e4208372a7d3f57ba34248421c93))
11
+
12
+ - Apply bindings wrapper to Images, RateLimit, and Analytics Engine
13
+ ([#130](https://github.com/cloudflare/workers-py/pull/130),
14
+ [`79eeaf9`](https://github.com/cloudflare/workers-py/commit/79eeaf94ab02e4208372a7d3f57ba34248421c93))
15
+
16
+ - Wrap AI, Images, Analytics Engine, Vectorize and RateLimit Bindings to accept native Python
17
+ objects ([#130](https://github.com/cloudflare/workers-py/pull/130),
18
+ [`79eeaf9`](https://github.com/cloudflare/workers-py/commit/79eeaf94ab02e4208372a7d3f57ba34248421c93))
19
+
20
+
21
+ ## v1.4.3 (2026-06-18)
22
+
23
+ ### Bug Fixes
24
+
25
+ - Ensure Worker subclasses are wrapped only once
26
+ ([#126](https://github.com/cloudflare/workers-py/pull/126),
27
+ [`af8ec42`](https://github.com/cloudflare/workers-py/commit/af8ec42eed1e2bbe6da1dbd537eb7a475f7071fb))
28
+
29
+
5
30
  ## v1.4.2 (2026-06-18)
6
31
 
7
32
  ### Bug Fixes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: workers-runtime-sdk
3
- Version: 1.4.2
3
+ Version: 1.5.0
4
4
  Summary: Python SDK for Cloudflare Workers
5
5
  Project-URL: Homepage, https://github.com/cloudflare/workers-py
6
6
  Project-URL: Bug Tracker, https://github.com/cloudflare/workers-py/issues
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "workers-runtime-sdk"
7
- version = "1.4.2"
7
+ version = "1.5.0"
8
8
  description = "Python SDK for Cloudflare Workers"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -1313,6 +1313,13 @@ class _EnvWrapper:
1313
1313
  "R2Bucket",
1314
1314
  "D1Database",
1315
1315
  "WorkerQueue",
1316
+ "Ai",
1317
+ "VectorizeIndexImpl",
1318
+ "AnalyticsEngineDataset",
1319
+ "LocalAnalyticsEngineDataset",
1320
+ "ImagesBindingImpl",
1321
+ "HostedImagesBindingImpl",
1322
+ "Ratelimit",
1316
1323
  }
1317
1324
 
1318
1325
  def __init__(self, env: Any):
@@ -1532,6 +1539,26 @@ async def _do_call(entrypoint, name, config, callback, *results):
1532
1539
  return result
1533
1540
 
1534
1541
 
1542
+ def _is_direct_binding_subclass(cls: type, binding_cls: type) -> bool:
1543
+ """
1544
+ Checks if the class is a direct subclass of the binding class.
1545
+
1546
+ In order to prevent applying the wrapper multiple times,
1547
+ we only want to apply the wrapper if the class is directly inheriting
1548
+ from the binding class, not if it's inheriting from another class that
1549
+ inherits from the binding class.
1550
+
1551
+ Examples:
1552
+ - `class A(DurableObject)` -> True
1553
+ - `class B(A)` -> False
1554
+ - `class C(B)` -> False
1555
+ - `class D(C, DurableObject)` -> False
1556
+ """
1557
+ return not any(
1558
+ issubclass(b, binding_cls) for b in cls.__bases__ if b is not binding_cls
1559
+ )
1560
+
1561
+
1535
1562
  def _wrap_subclass(cls):
1536
1563
  # Override the class __init__ so that we can wrap the `env` in the constructor.
1537
1564
  original_init = cls.__init__
@@ -1590,7 +1617,8 @@ class DurableObject:
1590
1617
  self.env = env
1591
1618
 
1592
1619
  def __init_subclass__(cls, **_kwargs):
1593
- _wrap_subclass(cls)
1620
+ if _is_direct_binding_subclass(cls, DurableObject):
1621
+ _wrap_subclass(cls)
1594
1622
 
1595
1623
 
1596
1624
  class WorkerEntrypoint:
@@ -1606,8 +1634,9 @@ class WorkerEntrypoint:
1606
1634
  self.env = env
1607
1635
 
1608
1636
  def __init_subclass__(cls, **_kwargs: Any):
1609
- _wrap_subclass(cls)
1610
- _wrap_queue_handler(cls)
1637
+ if _is_direct_binding_subclass(cls, WorkerEntrypoint):
1638
+ _wrap_subclass(cls)
1639
+ _wrap_queue_handler(cls)
1611
1640
 
1612
1641
 
1613
1642
  class WorkflowEntrypoint:
@@ -1623,8 +1652,9 @@ class WorkflowEntrypoint:
1623
1652
  self.env = env
1624
1653
 
1625
1654
  def __init_subclass__(cls, **_kwargs: Any):
1626
- _wrap_subclass(cls)
1627
- _wrap_workflow_step(cls)
1655
+ if _is_direct_binding_subclass(cls, WorkflowEntrypoint):
1656
+ _wrap_subclass(cls)
1657
+ _wrap_workflow_step(cls)
1628
1658
 
1629
1659
 
1630
1660
  def _wrap_queue_handler(cls):