Can You Deploy Python to Cloudflare Workers?
Cloudflare Python Workers reached general availability in September 2026 — FastAPI, Django, and Flask run natively, with real limitations worth knowing first
Yes — Cloudflare Python Workers reached general availability on 21 September 2026, running FastAPI, Django, and Flask natively. It’s a real, production-ready platform now, not an experimental preview — but it runs Python differently than you’re used to, which matters for what will and won’t work.
What “general availability” actually means here
Cloudflare introduced Python Workers as a preview roughly two years before this GA announcement. Reaching general availability means Cloudflare now considers it a first-class, fully supported language on their Developer Platform, alongside JavaScript — not a side experiment with fewer guarantees.
It’s Python compiled to WebAssembly, not native CPython
Python Workers run on Pyodide, a Python distribution compiled to WebAssembly, executed inside Cloudflare’s JavaScript-based Workers runtime rather than a native CPython process. This is the detail that actually matters for whether your project will work: pure-Python packages generally run fine, but anything with a C or Rust extension underneath (a large share of the scientific Python stack, and plenty of everyday libraries) needs a WebAssembly-compiled build to work at all.
PEP 783 standardizes this as the “PyEmscripten” wheel platform tag on PyPI, and tooling like cibuildwheel can produce these builds — but ecosystem adoption is still in progress. Don’t assume a specific dependency works until you’ve checked; a growing number of packages ship PyEmscripten wheels, but it’s far from universal yet.
The frameworks you already know, running natively
FastAPI, Django, and Flask all run through built-in ASGI/WSGI connectors, with no separate web server process to manage — Cloudflare’s platform handles the request/response cycle directly. Workers also connect straight to Cloudflare’s own D1 (database), R2 (object storage), Queues, Workflows, Durable Objects, and Hyperdrive (Postgres/MySQL connection pooling) without writing any JavaScript glue code, and newly added TCP socket support means standard Python database drivers (aiomysql, asyncpg) work as expected rather than needing a Workers-specific replacement.
Type conversion got simpler
Earlier versions of Python Workers needed manual to_js() conversions to pass data across the Python/JavaScript boundary when calling platform APIs. That’s gone for common cases now — something like self.env.QUEUE.send({"key": "value"}) works directly as plain Python.
A minimal FastAPI Worker, step by step
Cloudflare’s tool for this is pywrangler, a wrapper around wrangler that installs your Python packages and bundles them. It needs uv and Node installed, and uvx --from workers-py pywrangler init sets a project up. The same project written by hand is three small files. pyproject.toml:
[project]
name = "hello-python-worker"
version = "0.1.0"
requires-python = ">=3.13"
dependencies = ["fastapi"]
[dependency-groups]
dev = ["workers-py", "workers-runtime-sdk"]wrangler.jsonc, where the python_workers compatibility flag is what turns Python support on:
{
"name": "hello-python-worker",
"main": "src/entry.py",
"compatibility_flags": ["python_workers"],
"compatibility_date": "2026-11-11"
}And src/entry.py, an ordinary FastAPI app with one extra line at the bottom:
import sys
from fastapi import FastAPI
from workers import asgi
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello from FastAPI", "python": sys.version.split()[0], "platform": sys.platform}
@app.get("/items/{item_id}")
async def item(item_id: int, q: str | None = None):
return {"item_id": item_id, "q": q}
Default = asgi.entrypoint(app)uv run pywrangler dev runs it locally and uv run pywrangler deploy publishes it. Run locally with pywrangler dev, it served {"message":"Hello from FastAPI","python":"3.14.2","platform":"emscripten"}, which is the runtime detail from the section above showing through: the Python version is the one Pyodide ships, and the platform is emscripten, not darwin or linux. Path and query parameters worked (/items/42?q=hello returned {"item_id":42,"q":"hello"}), a bad path value got FastAPI’s normal 422 validation error, and the automatic /docs page loaded. There was no uvicorn command anywhere, because the platform plays that role.
A deploy needs a Cloudflare account, and I tested only the local run and a dry-run deploy, not a live deployment.
What the bundle looks like
The dry-run deploy for that FastAPI project reported 430 vendored modules, 9,479 KiB uploaded and 2,374 KiB gzipped. Cloudflare’s limits page lists a Worker size limit of 64 MiB on both plans, so a plain FastAPI app uses a small share of it. Dependencies are bundled at deploy time rather than installed on the server, so what you ship is exactly what pywrangler resolved.
Which packages work
Cloudflare’s docs say Python Workers support pure-Python packages, packages with PyEmscripten wheels on PyPI, and the packages that ship inside Pyodide itself. The failure mode for everything else is early and clear. Adding uvloop, a C-extension package, to the dependencies made pywrangler sync stop with uvloop==0.6.1 has no wheels with a matching Python ABI tag (e.g., cp314), so you find out before deploying. Adding numpy, which Pyodide bundles, synced without complaint.
The practical test for any dependency is to put it in pyproject.toml and run uv run pywrangler sync. Cloudflare asks you to request PyEmscripten wheels from a package’s maintainers if one is missing.
Limits worth knowing
From Cloudflare’s Workers limits page on 11 November 2026 (these change, so check the page before relying on them):
| Limit | Workers Free | Workers Paid |
|---|---|---|
| CPU time per request | 10 ms | 5 minutes (30 seconds by default) |
| Memory per isolate | 128 MB | 128 MB |
| Subrequests per request | 50 | 10,000 |
| Simultaneous outgoing connections per request | 6 | 6 |
| Worker size | 64 MiB | 64 MiB |
| Startup time (global scope) | 1 second | 1 second |
The CPU limit is on CPU time per request, and Cloudflare says the average Worker uses about 2.2 ms. The 1-second startup limit applies to the code that runs when the Worker loads, so heavy initialisation at the top of a module counts, and larger bundles make it harder to stay inside. The memory limit is per isolate and includes WebAssembly allocations, which is where the Python runtime and your packages live, so it is worth checking before reaching for a large data-science stack.
The practical read
If your project is built on FastAPI, Django, or Flask with mostly pure-Python dependencies, Cloudflare Python Workers is now a genuine, supported deployment option worth evaluating alongside more familiar platforms. If your project leans on C/Rust-backed packages — NumPy-heavy data processing, certain cryptography or image libraries — check PyEmscripten wheel availability for your specific dependencies before committing, since that’s the actual limiting factor, not the framework layer.
Frequently Asked Questions
Can you actually deploy Python to Cloudflare Workers?
Yes — Cloudflare Python Workers reached general availability on 21 September 2026, meaning Python is now a first-class, fully supported language on Cloudflare’s platform, not an experimental preview.
Does Cloudflare run real CPython, or something else?
Python Workers run on Pyodide, a Python distribution compiled to WebAssembly — not a native CPython process. This is why package compatibility isn’t automatic: pure-Python packages generally work fine, but anything with a C or Rust extension needs to be cross-compiled to WebAssembly first.
Do FastAPI, Django, and Flask work on Cloudflare Workers?
Yes, natively, through built-in ASGI/WSGI connectors — no separate web server process needed, since Cloudflare’s platform handles the request/response cycle directly.
What’s the catch with Cloudflare Python Workers?
Package compatibility. Anything with C/C++/Rust-dependent code needs a WebAssembly build (via PEP 783’s PyEmscripten platform and cibuildwheel), and ecosystem adoption of that is still ongoing — plenty of PyPI packages don’t have WebAssembly wheels yet. Check before assuming a specific dependency will work.
How do you run a Python Worker locally?
Install uv and Node, then use pywrangler, Cloudflare’s CLI for Python Workers. uvx —from workers-py pywrangler init creates a project, uv run pywrangler dev serves it locally (on port 8787 by default), and uv run pywrangler deploy publishes it. The wrangler config must include the python_workers compatibility flag.
How do you run FastAPI on Cloudflare Workers?
Keep your FastAPI app as it is and add Default = asgi.entrypoint(app) at the bottom of the entry file, importing asgi from the workers module. There is no uvicorn command, because the Workers platform acts as the web server.
What happens if a package has no WebAssembly build?
pywrangler sync fails before you deploy. Adding uvloop produced an error that it had no wheels with a matching Python ABI tag. Packages need to be pure Python, have PyEmscripten wheels, or be included in Pyodide.