From 27aa1c1b5f85262d645c9757b5e59878bee574a1 Mon Sep 17 00:00:00 2001 From: Diogo Ferreira Date: Mon, 25 Aug 2025 17:07:45 +0100 Subject: [PATCH] - created changelog entry for Python Workflows beta release --- .../2025-08-22-workflows-python-beta.mdx | 50 +++++++++++++++++++ .../docs/workflows/python/bindings.mdx | 10 ++++ src/content/docs/workflows/python/index.mdx | 2 + src/content/release-notes/workflows.yaml | 6 +++ 4 files changed, 68 insertions(+) create mode 100644 src/content/changelog/workflows/2025-08-22-workflows-python-beta.mdx diff --git a/src/content/changelog/workflows/2025-08-22-workflows-python-beta.mdx b/src/content/changelog/workflows/2025-08-22-workflows-python-beta.mdx new file mode 100644 index 00000000000000..816d2efe2c8762 --- /dev/null +++ b/src/content/changelog/workflows/2025-08-22-workflows-python-beta.mdx @@ -0,0 +1,50 @@ +--- +title: Build durable multi-step applications in Python with Workflows (now in beta) +description: Python Workflows is now open beta - build Workflows in Python. +products: + - workflows + - workers +date: 2025-08-22 +--- + +import { Render, PackageManagers, TypeScriptExample } from "~/components" + +You can now build [Workflows](/workflows/) using Python. With Python Workflows, you get automatic retries, state persistence, and the ability to run multi-step operations that can span minutes, hours, or weeks using Python’s familiar syntax and the [Python Workers](/workers/languages/python/) runtime. + +Python Workflows use the same step-based execution model as JavaScript Workflows, but with Python syntax and access to Python’s ecosystem. Python Workflows also enable [DAG (Directed Acyclic Graph) workflows](/workflows/python/dag/), where you can define complex dependencies between steps using the depends parameter. + +Here’s a simple example: + +```python +from workers import Response, WorkflowEntrypoint + +class PythonWorkflowStarter(WorkflowEntrypoint): + async def run(self, event, step): + @step.do("my first step") + async def my_first_step(): + # do some work + return "Hello Python!" + + await my_first_step() + + await step.sleep("my-sleep-step", "10 seconds") + + @step.do("my second step") + async def my_second_step(): + # do some more work + return "Hello again!" + + await my_second_step() + +async def on_fetch(request, env): + await env.MY_WORKFLOW.create() + return Response("Hello Workflow creation!") +``` + +:::note +Python Workflows requires a `compatibility_date = "2025-08-01"`, or lower, in your wrangler toml file. +::: + +Python Workflows support the same core capabilities as JavaScript Workflows, including sleep scheduling, event-driven workflows, and built-in error handling with configurable retry policies. + +To learn more and get started, refer to [Python Workflows documentation](/workflows/python/). \ No newline at end of file diff --git a/src/content/docs/workflows/python/bindings.mdx b/src/content/docs/workflows/python/bindings.mdx index c733b24048c1ac..75983d200d0b9d 100644 --- a/src/content/docs/workflows/python/bindings.mdx +++ b/src/content/docs/workflows/python/bindings.mdx @@ -9,6 +9,13 @@ sidebar: --- import { WranglerConfig } from "~/components" +:::caution[Python Workflows are in beta, as well as the underlying platform.] + +You must add both `python_workflows` and `python_workers` compatibility flags to your `wrangler.toml` file. + +Also, Python Workflows requires `compatibility_date = "2025-08-01"`, or lower, to be set in your `wrangler.toml` file. +::: + 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. From the configuration perspective, enabling Python Workflows requires adding the `python_workflows` compatibility flag to your `wrangler.toml` file. @@ -67,6 +74,7 @@ Create (trigger) a new instance of a given Workflow. ```python from pyodide.ffi import to_js +from js import Object async def on_fetch(request, env, ctx): event = {"foo": "bar"} @@ -93,6 +101,7 @@ Each element of the `batch` list is expected to include both `id` and `params` p ```python from pyodide.ffi import to_js +from js import Object # Create a new batch of 3 Workflow instances, each with its own ID and pass params to the Workflow instances listOfInstances = [ @@ -134,6 +143,7 @@ Send an event to a workflow instance. ```python from pyodide.ffi import to_js +from js import Object await env.MY_WORKFLOW.send_event(to_js({ "type": "my-event-type", "payload": { "foo": "bar" } }, dict_converter=Object.fromEntries)) ``` diff --git a/src/content/docs/workflows/python/index.mdx b/src/content/docs/workflows/python/index.mdx index 8284a7efc497e9..ee5964030e494a 100644 --- a/src/content/docs/workflows/python/index.mdx +++ b/src/content/docs/workflows/python/index.mdx @@ -15,6 +15,8 @@ Refer to [Python Workers](/workers/languages/python) for more information about You must add both `python_workflows` and `python_workers` compatibility flags to your `wrangler.toml` file. +Also, Python Workflows requires `compatibility_date = "2025-08-01"`, or lower, to be set in your `wrangler.toml` file. + 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. ::: diff --git a/src/content/release-notes/workflows.yaml b/src/content/release-notes/workflows.yaml index ef4f05398314ef..39c4ace8c69435 100644 --- a/src/content/release-notes/workflows.yaml +++ b/src/content/release-notes/workflows.yaml @@ -3,6 +3,12 @@ link: "/workflows/reference/changelog/" productName: Workflows productLink: "/workflows/" entries: + - publish_date: "2025-08-22" + title: "Python Workflows is now open beta" + description: |- + [Python Workflows](/workflows/python/) is now in open beta, and available to any developer a free or paid Workers plan. + + More information available in the [changelog](/changelog/2025-08-22-workflows-python-beta/). - publish_date: "2025-05-07" title: "Search for specific Workflows" description: |-