workers-runtime-sdk 1.4.2__tar.gz → 1.4.3__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.4.3}/CHANGELOG.md +9 -0
  2. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/PKG-INFO +1 -1
  3. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/pyproject.toml +1 -1
  4. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/src/workers/_workers.py +28 -5
  5. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/.gitignore +0 -0
  6. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/AGENTS.md +0 -0
  7. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/README.md +0 -0
  8. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/src/_cloudflare_compat_flags.pyi +0 -0
  9. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/src/_pyodide_entrypoint_helper.pyi +0 -0
  10. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/src/_workers_sdk_entropy_import_context.pth +0 -0
  11. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/src/_workers_sdk_entropy_import_context.py +0 -0
  12. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/src/_workers_sdk_entropy_import_context_loader.py +0 -0
  13. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/src/asgi.py +0 -0
  14. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/src/workers/__init__.py +0 -0
  15. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/src/workers/py.typed +0 -0
  16. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/src/workers/workflows.py +0 -0
  17. {workers_runtime_sdk-1.4.2 → workers_runtime_sdk-1.4.3}/uv.lock +0 -0
@@ -2,6 +2,15 @@
2
2
 
3
3
  <!-- version list -->
4
4
 
5
+ ## v1.4.3 (2026-06-18)
6
+
7
+ ### Bug Fixes
8
+
9
+ - Ensure Worker subclasses are wrapped only once
10
+ ([#126](https://github.com/cloudflare/workers-py/pull/126),
11
+ [`af8ec42`](https://github.com/cloudflare/workers-py/commit/af8ec42eed1e2bbe6da1dbd537eb7a475f7071fb))
12
+
13
+
5
14
  ## v1.4.2 (2026-06-18)
6
15
 
7
16
  ### 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.4.3
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.4.3"
8
8
  description = "Python SDK for Cloudflare Workers"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -1532,6 +1532,26 @@ async def _do_call(entrypoint, name, config, callback, *results):
1532
1532
  return result
1533
1533
 
1534
1534
 
1535
+ def _is_direct_binding_subclass(cls: type, binding_cls: type) -> bool:
1536
+ """
1537
+ Checks if the class is a direct subclass of the binding class.
1538
+
1539
+ In order to prevent applying the wrapper multiple times,
1540
+ we only want to apply the wrapper if the class is directly inheriting
1541
+ from the binding class, not if it's inheriting from another class that
1542
+ inherits from the binding class.
1543
+
1544
+ Examples:
1545
+ - `class A(DurableObject)` -> True
1546
+ - `class B(A)` -> False
1547
+ - `class C(B)` -> False
1548
+ - `class D(C, DurableObject)` -> False
1549
+ """
1550
+ return not any(
1551
+ issubclass(b, binding_cls) for b in cls.__bases__ if b is not binding_cls
1552
+ )
1553
+
1554
+
1535
1555
  def _wrap_subclass(cls):
1536
1556
  # Override the class __init__ so that we can wrap the `env` in the constructor.
1537
1557
  original_init = cls.__init__
@@ -1590,7 +1610,8 @@ class DurableObject:
1590
1610
  self.env = env
1591
1611
 
1592
1612
  def __init_subclass__(cls, **_kwargs):
1593
- _wrap_subclass(cls)
1613
+ if _is_direct_binding_subclass(cls, DurableObject):
1614
+ _wrap_subclass(cls)
1594
1615
 
1595
1616
 
1596
1617
  class WorkerEntrypoint:
@@ -1606,8 +1627,9 @@ class WorkerEntrypoint:
1606
1627
  self.env = env
1607
1628
 
1608
1629
  def __init_subclass__(cls, **_kwargs: Any):
1609
- _wrap_subclass(cls)
1610
- _wrap_queue_handler(cls)
1630
+ if _is_direct_binding_subclass(cls, WorkerEntrypoint):
1631
+ _wrap_subclass(cls)
1632
+ _wrap_queue_handler(cls)
1611
1633
 
1612
1634
 
1613
1635
  class WorkflowEntrypoint:
@@ -1623,8 +1645,9 @@ class WorkflowEntrypoint:
1623
1645
  self.env = env
1624
1646
 
1625
1647
  def __init_subclass__(cls, **_kwargs: Any):
1626
- _wrap_subclass(cls)
1627
- _wrap_workflow_step(cls)
1648
+ if _is_direct_binding_subclass(cls, WorkflowEntrypoint):
1649
+ _wrap_subclass(cls)
1650
+ _wrap_workflow_step(cls)
1628
1651
 
1629
1652
 
1630
1653
  def _wrap_queue_handler(cls):