cloudflare
For CloudFlare development, deployment, e.g. Python CloudFlare Workers
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
General
- Modifying code while
wrangler devis running slows it down. Stop, edit, then restart.
Python Cloudflare Workers
Sample wrangler.toml:
name = "..."
main = "..."
compatibility_date = "..."
compatibility_flags = ["python_workers"]
[observability]
enabled = true
Sample entry.py:
from workers import Response, WorkerEntrypoint
class Default(WorkerEntrypoint):
async def fetch(self, request, env) -> Response:
return Response('{"x": 1}', headers={"content-type": "application/json"})
To integrate a FastAPI app:
from workers import WorkerEntrypoint
from my_fastapi_app import app
import asgi
class Default(WorkerEntrypoint):
async def fetch(self, request):
return await asgi.fetch(app, request.js_object, self.env)
Usage notes:
- Ensure there's a
pyproject.tomlwith dependencies. - Prep env:
uv add --dev workers-py workers-runtime-sdk - Vendor deps (if any):
uv run pywrangler sync(usespython_modules). - Dev:
uv run pywrangler devthen hit http://localhost:8787. - Deploy:
uv run pywrangler deploy. - Verify:
curl https://<worker-name>.<account>.workers.dev.
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-20
- Index updated
- 2026-01-30
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!