You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/workflows/python/bindings.mdx
+17-19Lines changed: 17 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,16 @@ pcx_content_type: concept
4
4
sidebar:
5
5
order: 3
6
6
group:
7
-
hideIndex: true
8
-
7
+
hideIndex: true
9
8
---
10
-
import { WranglerConfig } from"~/components"
9
+
10
+
import { WranglerConfig } from"~/components";
11
11
12
12
:::caution[Python Workflows are in beta, as well as the underlying platform.]
13
13
14
-
You must add both `python_workflows` and `python_workers` compatibility flags to your `wrangler.toml` file.
14
+
You must add both `python_workflows` and `python_workers` compatibility flags to your Wrangler config file.
15
15
16
-
Also, Python Workflows requires `compatibility_date = "2025-08-01"`, or lower, to be set in your `wrangler.toml` file.
16
+
Also, Python Workflows requires `compatibility_date = "2025-08-01"`, or later, to be set in your Wrangler config file.
17
17
:::
18
18
19
19
The Python Workers platform leverages FFI to access bindings to Cloudflare resources. Refer to the [bindings](/workers/languages/python/ffi/#using-bindings-from-python-workers) documentation for more information.
@@ -40,7 +40,6 @@ class_name = "MyWorkflow"
40
40
41
41
</WranglerConfig>
42
42
43
-
44
43
And this is how you use the payload in your workflow:
45
44
46
45
```python
@@ -54,23 +53,22 @@ class DemoWorkflowClass(WorkflowEntrypoint):
54
53
return payload
55
54
```
56
55
57
-
58
56
## Workflow
59
57
60
58
The `Workflow` binding gives you access to the [Workflow](/workflows/build/workers-api/#workflow) class. All its methods are available
61
59
on the binding.
62
60
63
-
Under the hood, the `Workflow` binding is a Javascript object that is exposed to the Python script via [JsProxy](https://pyodide.org/en/stable/usage/api/python-api/ffi.html#pyodide.ffi.JsProxy).
61
+
Under the hood, the `Workflow` binding is a Javascript object that is exposed to the Python script via [JsProxy](https://pyodide.org/en/stable/usage/api/python-api/ffi.html#pyodide.ffi.JsProxy).
64
62
This means that the values returned by its methods are also `JsProxy` objects, and need to be converted back into Python objects using `python_from_rpc`.
65
63
66
-
67
64
### `create`
68
65
69
66
Create (trigger) a new instance of a given Workflow.
70
67
71
-
* <code>create(options=None)</code>
72
-
*`options` - an **optional** dictionary of options to pass to the workflow instance. Should contain the same keys
73
-
as the [WorkflowInstanceCreateOptions](/workflows/build/workers-api/#workflowinstancecreateoptions) type.
68
+
- <code>create(options=None)</code>*`options` - an **optional** dictionary of
69
+
options to pass to the workflow instance. Should contain the same keys as the
Values returned from steps need to be converted into Javascript objects using `to_js`. This is why we explicitly construct the payload using `Object.fromEntries`.
@@ -94,8 +93,9 @@ The `create` method returns a [`WorkflowInstance`](/workflows/build/workers-api/
94
93
95
94
Create (trigger) a batch of new workflow instances, up to 100 instances at a time. This is useful if you need to create multiple instances at once within the [instance creation limit](/workflows/reference/limits/).
96
95
97
-
* <code>create_batch(batch)</code>
98
-
*`batch` - list of `WorkflowInstanceCreateOptions` to pass when creating an instance, including a user-provided ID and payload parameters.
96
+
- <code>create_batch(batch)</code>*`batch` - list of
97
+
`WorkflowInstanceCreateOptions` to pass when creating an instance, including a
98
+
user-provided ID and payload parameters.
99
99
100
100
Each element of the `batch` list is expected to include both `id` and `params` properties:
Copy file name to clipboardExpand all lines: src/content/docs/workflows/python/index.mdx
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,15 +7,14 @@ sidebar:
7
7
text: Beta
8
8
---
9
9
10
-
11
10
Workflow entrypoints can be declared using Python. To achieve this, you can export a `WorkflowEntrypoint` that runs on the Cloudflare Workers platform.
12
11
Refer to [Python Workers](/workers/languages/python) for more information about Python on the Workers runtime.
13
12
14
13
:::caution[Python Workflows are in beta, as well as the underlying platform.]
15
14
16
-
You must add both `python_workflows` and `python_workers` compatibility flags to your `wrangler.toml` file.
15
+
You must add both `python_workflows` and `python_workers` compatibility flags to your Wrangler config file.
17
16
18
-
Also, Python Workflows requires`compatibility_date = "2025-08-01"`, or lower, to be set in your `wrangler.toml` file.
17
+
Also, Python Workflows require`compatibility_date = "2025-08-01"`, or later, to be set in your Wrangler config file.
19
18
20
19
Join the #python-workers channel in the [Cloudflare Developers Discord](https://discord.cloudflare.com/) and let us know what you'd like to see next.
21
20
:::
@@ -42,4 +41,4 @@ To deploy a Python Workflow to Cloudflare, run [`wrangler deploy`](/workers/wran
0 commit comments