workers-runtime-sdk 1.5.2__tar.gz → 1.5.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.
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/CHANGELOG.md +9 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/PKG-INFO +1 -1
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/pyproject.toml +7 -2
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/workers/_workers.py +39 -42
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/uv.lock +1 -1
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/.gitignore +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/AGENTS.md +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/README.md +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/_cloudflare_compat_flags.pyi +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/_pyodide_entrypoint_helper.pyi +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/_workers_sdk_entropy_import_context.pth +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/_workers_sdk_entropy_import_context.py +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/_workers_sdk_entropy_import_context_loader.py +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/asgi.py +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/workers/__init__.py +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/workers/blob.py +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/workers/fetch.py +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/workers/formdata.py +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/workers/py.typed +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/workers/request.py +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/workers/response.py +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/workers/rpc.py +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/workers/types.py +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/workers/utils.py +0 -0
- {workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/workers/workflows.py +0 -0
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- version list -->
|
|
4
4
|
|
|
5
|
+
## v1.5.3 (2026-07-03)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- Update Workflows wrapper to work more natively with Python objects
|
|
10
|
+
([#138](https://github.com/cloudflare/workers-py/pull/138),
|
|
11
|
+
[`63ea6a0`](https://github.com/cloudflare/workers-py/commit/63ea6a0842875e04f3883bd050a097a3ef7152bd))
|
|
12
|
+
|
|
13
|
+
|
|
5
14
|
## v1.5.2 (2026-07-01)
|
|
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.5.
|
|
3
|
+
Version: 1.5.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.5.
|
|
7
|
+
version = "1.5.3"
|
|
8
8
|
description = "Python SDK for Cloudflare Workers"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
@@ -88,7 +88,12 @@ allow_zero_version = false
|
|
|
88
88
|
no_git_verify = false
|
|
89
89
|
tag_format = "workers-runtime-sdk-v{version}"
|
|
90
90
|
version_toml = ["pyproject.toml:project.version"]
|
|
91
|
-
build_command = "
|
|
91
|
+
build_command = """
|
|
92
|
+
pip install uv
|
|
93
|
+
uv lock --upgrade-package "$PACKAGE_NAME"
|
|
94
|
+
git add uv.lock
|
|
95
|
+
uv build
|
|
96
|
+
"""
|
|
92
97
|
|
|
93
98
|
[tool.semantic_release.branches.main]
|
|
94
99
|
match = "(main|master)"
|
|
@@ -94,6 +94,12 @@ class _BindingWrapper:
|
|
|
94
94
|
]
|
|
95
95
|
return converted
|
|
96
96
|
|
|
97
|
+
@staticmethod
|
|
98
|
+
def _convert_args(args, kwargs):
|
|
99
|
+
js_args = [python_to_rpc(arg) for arg in args]
|
|
100
|
+
js_kwargs = {k: python_to_rpc(v) for k, v in kwargs.items()}
|
|
101
|
+
return js_args, js_kwargs
|
|
102
|
+
|
|
97
103
|
def _getattr_helper(self, name):
|
|
98
104
|
attr = getattr(self._binding, name)
|
|
99
105
|
|
|
@@ -101,8 +107,7 @@ class _BindingWrapper:
|
|
|
101
107
|
return self._convert_result(attr)
|
|
102
108
|
|
|
103
109
|
def wrapper(*args, **kwargs):
|
|
104
|
-
js_args =
|
|
105
|
-
js_kwargs = {k: python_to_rpc(v) for k, v in kwargs.items()}
|
|
110
|
+
js_args, js_kwargs = self._convert_args(args, kwargs)
|
|
106
111
|
result = attr(*js_args, **js_kwargs)
|
|
107
112
|
if hasattr(result, "then") and callable(result.then):
|
|
108
113
|
|
|
@@ -207,49 +212,34 @@ class DurableObjectContext:
|
|
|
207
212
|
raise DurableObjectAbort(reason or "Durable Object abort requested")
|
|
208
213
|
|
|
209
214
|
|
|
210
|
-
class _WorkflowInstanceWrapper:
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
def __getattr__(self, name):
|
|
215
|
-
return getattr(self._binding, name)
|
|
215
|
+
class _WorkflowInstanceWrapper(_BindingWrapper):
|
|
216
|
+
# status/pause/resume/restart/terminate share their JS names and are handled by
|
|
217
|
+
# the _BindingWrapper, which already converts arguments and results.
|
|
218
|
+
# Only send_event needs the snake_case -> camelCase mapping for backward compatibility
|
|
216
219
|
|
|
217
220
|
async def send_event(self, *args, **kwargs):
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
async def resume(self, *args, **kwargs):
|
|
224
|
-
return self._binding.resume(*args, **kwargs)
|
|
225
|
-
|
|
226
|
-
async def terminate(self, *args, **kwargs):
|
|
227
|
-
return self._binding.terminate(*args, **kwargs)
|
|
228
|
-
|
|
229
|
-
async def restart(self, *args, **kwargs):
|
|
230
|
-
return self._binding.restart(*args, **kwargs)
|
|
231
|
-
|
|
232
|
-
async def status(self, *args, **kwargs):
|
|
233
|
-
return self._binding.status(*args, **kwargs)
|
|
234
|
-
|
|
221
|
+
js_args, js_kwargs = self._convert_args(args, kwargs)
|
|
222
|
+
return self._convert_result(
|
|
223
|
+
await self._binding.sendEvent(*js_args, **js_kwargs)
|
|
224
|
+
)
|
|
235
225
|
|
|
236
|
-
class _WorkflowBindingWrapper:
|
|
237
|
-
def __init__(self, binding):
|
|
238
|
-
self._binding = binding
|
|
239
|
-
|
|
240
|
-
def __getattr__(self, name):
|
|
241
|
-
return getattr(self._binding, name)
|
|
242
226
|
|
|
227
|
+
class _WorkflowBindingWrapper(_BindingWrapper):
|
|
243
228
|
async def get(self, *args, **kwargs):
|
|
244
|
-
|
|
229
|
+
js_args, js_kwargs = self._convert_args(args, kwargs)
|
|
230
|
+
return _WorkflowInstanceWrapper(await self._binding.get(*js_args, **js_kwargs))
|
|
245
231
|
|
|
246
232
|
async def create(self, *args, **kwargs):
|
|
247
|
-
|
|
233
|
+
js_args, js_kwargs = self._convert_args(args, kwargs)
|
|
234
|
+
return _WorkflowInstanceWrapper(
|
|
235
|
+
await self._binding.create(*js_args, **js_kwargs)
|
|
236
|
+
)
|
|
248
237
|
|
|
249
238
|
async def create_batch(self, *args, **kwargs):
|
|
239
|
+
js_args, js_kwargs = self._convert_args(args, kwargs)
|
|
250
240
|
return [
|
|
251
241
|
_WorkflowInstanceWrapper(w)
|
|
252
|
-
for w in await self._binding.createBatch(*
|
|
242
|
+
for w in await self._binding.createBatch(*js_args, **js_kwargs)
|
|
253
243
|
]
|
|
254
244
|
|
|
255
245
|
|
|
@@ -433,13 +423,15 @@ class _WorkflowStepWrapper:
|
|
|
433
423
|
|
|
434
424
|
return self._js_step.sleepUntil(name, timestamp)
|
|
435
425
|
|
|
436
|
-
def wait_for_event(self, name, event_type, /, timeout="24 hours"):
|
|
437
|
-
return
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
426
|
+
async def wait_for_event(self, name, event_type, /, timeout="24 hours"):
|
|
427
|
+
return python_from_rpc(
|
|
428
|
+
await self._js_step.waitForEvent(
|
|
429
|
+
name,
|
|
430
|
+
to_js(
|
|
431
|
+
{"type": event_type, "timeout": timeout},
|
|
432
|
+
dict_converter=Object.fromEntries,
|
|
433
|
+
),
|
|
434
|
+
)
|
|
443
435
|
)
|
|
444
436
|
|
|
445
437
|
async def _resolve_dependency(self, dep):
|
|
@@ -531,7 +523,12 @@ def _wrap_workflow_step(cls):
|
|
|
531
523
|
if inspect.iscoroutine(result):
|
|
532
524
|
result = await result
|
|
533
525
|
|
|
534
|
-
|
|
526
|
+
if result is None:
|
|
527
|
+
return result
|
|
528
|
+
|
|
529
|
+
# This should be wrapped again to js object
|
|
530
|
+
# as the value will go through the RPC boundary
|
|
531
|
+
return python_to_rpc(result)
|
|
535
532
|
|
|
536
533
|
cls.run = wrapped_run
|
|
537
534
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/_workers_sdk_entropy_import_context.pth
RENAMED
|
File without changes
|
{workers_runtime_sdk-1.5.2 → workers_runtime_sdk-1.5.3}/src/_workers_sdk_entropy_import_context.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|