Skip to content

Conversation

@hoodmane
Copy link
Contributor

Updating Python workers examples

@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2025

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/changelog/ @cloudflare/pm-changelogs, @cloudflare/pcx-technical-writing
/src/content/docs/workflows/ @elithrar, @celso, @mia303, @cloudflare/pcx-technical-writing

@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
cloudflare-docs-e2e b30242a Oct 13 2025, 03:02 PM

@mikenomitch mikenomitch enabled auto-merge (squash) October 16, 2025 14:57
@hoodmane hoodmane force-pushed the hoodmane/more-worker-entrypoint-class branch from b30242a to 52519e7 Compare October 16, 2025 16:02
@kodster28 kodster28 removed their assignment Nov 18, 2025
@github-actions
Copy link
Contributor

Hey there, we've marked this pull request as stale because there's no recent activity on it. This label is helps us identify PRs that might need updates (or to be closed out by our team if no longer relevant).

@github-actions github-actions bot added the stale label Nov 24, 2025
@pedrosousa pedrosousa requested a review from mia303 as a code owner November 24, 2025 11:49
class Default(WorkerEntrypoint):
async def fetch(self, request):
event = {"foo": "bar"}
options = to_js({"params": event}, dict_converter=Object.fromEntries)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm this is correct at the moment. But since we recently started wrapping the binding in the workers module, we can do this internally (with a compat flag)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it would be good to do that, we plan to do this for all bindings eventually

@Caio-Nogueira
Copy link
Contributor

We probably need to bump the compatibility date on the docs, right? We should have it set according to the python_no_global_handlers compat flag.

async def on_fetch(request, env):
await env.MY_WORKFLOW.create()
return Response("Hello Workflow creation!")
class Default(WorkerEntrypoint):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to import WorkerEntrypoint as well

@mikenomitch mikenomitch merged commit 5e83d1d into production Nov 24, 2025
8 checks passed
@mikenomitch mikenomitch deleted the hoodmane/more-worker-entrypoint-class branch November 24, 2025 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

October 2025 product:workers Related to Workers product product:workflows Workflows: https://developers.cloudflare.com/workflows/ size/s stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.