Direct answer: Cloudflare made Python Workers generally available on September 21, 2026. Python is now a fully supported Workers language, with first-class platform bindings, ASGI/WSGI connectors for frameworks including FastAPI, Django and Flask, Hyperdrive access to PostgreSQL and MySQL, and support for pure-Python, PyEmscripten and Pyodide packages.[1][2] For a new project, install uv and Node.js, initialize it with pywrangler, test locally, and deploy with uv run pywrangler deploy.[2]
Cloudflare Python Workers GA: what changed
The release is more than a label change from beta to GA. Cloudflare says Python Workers are now production-ready and can connect to Workers AI, R2, D1, Hyperdrive, Durable Objects, Queues and Workflows.[1]
The practical changes are:
- Python-native bindings: dictionaries and other Python values can cross the Workers binding boundary without hand-written JavaScript conversion code.[1]
- Framework connectors:
workers.asgisupports ASGI applications such as FastAPI, whileworkers.wsgisupports synchronous WSGI applications such as Django and Flask.[1] - Database networking: Cloudflare implemented socket calls over the Workers
connectAPI, enabling supported PostgreSQL and MySQL drivers through Hyperdrive.[1] - A broader package path: pure-Python and PyEmscripten packages on PyPI are supported, along with packages bundled by Pyodide.[4]
- AI libraries: Cloudflare says libraries including
openai,langchainandmcpcan run in Python Workers.[1]
Quick-start checklist
Before starting, install:
- a Cloudflare account;
- Node.js;
uv, the Python package and project manager;- a terminal with access to
uvxanduv.
Cloudflare’s current Python Workers tooling is pywrangler, a Python-focused wrapper around Wrangler that sets up the environment and bundles dependencies.[2][4]
1. Create the project
mkdir hello-python-worker
cd hello-python-worker
uvx --from workers-py pywrangler init
The initializer creates the project configuration, including a pyproject.toml development dependency for workers-py and a Wrangler configuration file.[2]
2. Add the Worker entry point
Create src/entry.py:
from workers import Response, WorkerEntrypoint
class Default(WorkerEntrypoint):
async def fetch(self, request):
return Response.json({
"ok": True,
"message": "Hello from a Python Worker"
})
A Python Worker receives HTTP requests through the fetch handler on a Default class derived from WorkerEntrypoint.[2]
3. Check the Wrangler configuration
Use a current compatibility date and point main to the Python entry file:
name = "hello-python-worker"
main = "src/entry.py"
compatibility_date = "2026-09-21"
compatibility_flags = ["python_workers"]
Cloudflare’s current framework examples still include the python_workers compatibility flag, so keep it unless the initializer or current documentation explicitly removes it for your project.
4. Run locally
uv run pywrangler dev
In another terminal, test the local URL displayed by pywrangler:
curl http://localhost:8787/
During local development, the runtime selects the Pyodide version from the compatibility date, installs declared packages, creates a V8 isolate, injects Pyodide, and serves the Python code without a separate compilation step.[3]
5. Deploy
Authenticate Wrangler if this machine has not already been connected to Cloudflare, then deploy:
uv run pywrangler deploy
At deployment, Cloudflare uploads and validates the Python code and packages, initializes Pyodide in an isolate, runs top-level imports, snapshots WebAssembly memory, and distributes that snapshot with the Worker. The snapshot is then used to reduce initialization work when requests arrive.[3]
6. Verify the deployment
Open the generated workers.dev URL and verify both the status code and response body:
curl -i https://YOUR-WORKER.YOUR-SUBDOMAIN.workers.dev/
Do not treat a successful deployment command as the entire test. Also exercise error routes, authentication, secrets, storage bindings and external calls used by the real application.
FastAPI example
Add FastAPI to pyproject.toml:
[project]
name = "fastapi-worker"
version = "0.1.0"
requires-python = ">=3.13"
dependencies = ["fastapi"]
[dependency-groups]
dev = ["workers-py", "workers-runtime-sdk"]
Then create src/main.py:
from fastapi import FastAPI
from workers import asgi
app = FastAPI()
@app.get("/")
async def root():
return {
"ok": True,
"runtime": "Cloudflare Python Workers"
}
@app.get("/health")
async def health():
return {"status": "healthy"}
Default = asgi.entrypoint(app)
Update main in the Wrangler configuration to src/main.py, then run uv run pywrangler dev. The workers.asgi connector translates Workers requests into the ASGI structures expected by FastAPI and returns the application response through the Workers runtime.[1]
You do not start Uvicorn inside the deployed Worker. Cloudflare’s platform handles incoming connections and scaling; the connector bridges requests to the application.[1]
Can Django and Flask run on Python Workers?
Yes. Cloudflare’s GA announcement explicitly names FastAPI, Django and Flask. ASGI is the preferred fit for asynchronous applications, while the workers.wsgi connector can serve synchronous WSGI applications.[1]
A minimal WSGI bridge follows this pattern:
from workers import wsgi
from your_app.wsgi import app
Default = wsgi.entrypoint(app)
Migration still requires testing. A traditional Django or Flask deployment may depend on a writable local filesystem, background processes, system libraries, blocking network calls or packages that have no compatible WebAssembly build. GA does not make every conventional server assumption available at the edge.
Package compatibility: check before migrating
Python Workers support:
- pure-Python packages published on PyPI;
- packages with PyEmscripten wheels on PyPI;
- packages included in Pyodide.[4]
WebAssembly package support is still developing, and Cloudflare warns that some packages do not yet publish compatible PyEmscripten wheels.[4] Check every important dependency before committing to a migration, especially packages with native C, C++ or Rust extensions.
For HTTP calls, Cloudflare’s package documentation currently lists asynchronous clients such as aiohttp and httpx2; the Workers JavaScript fetch() API is also available through Python’s foreign-function interface.[4]
Use this pre-migration check:
uv lock
uv run pywrangler dev
Then test imports and the real code paths. A package appearing in a lock file does not prove that its native features work correctly in the Workers WebAssembly environment.
Databases with Hyperdrive
The GA release adds a socket bridge that lets supported Python database drivers communicate through the Workers networking API. Cloudflare documents PostgreSQL and MySQL integration through Hyperdrive.[1]
The practical architecture is:
Python Worker → Hyperdrive binding → PostgreSQL or MySQL
Store database credentials in Cloudflare bindings or secrets, not in source code. Test connection reuse, transaction behavior, timeouts and driver support under realistic traffic. Hyperdrive is the intended bridge; do not assume a local database socket or unrestricted server environment exists.
Where Python Workers fit well
Good candidates include:
- small APIs and webhook receivers;
- FastAPI endpoints close to users;
- AI gateways and agent tools;
- MCP servers;
- queue consumers and workflow steps;
- RAG endpoints using Workers AI and Vectorize;
- lightweight data transformation;
- APIs that use D1, KV, R2 or Durable Objects.
Cloudflare provides production-oriented examples for AI orchestration, an MCP server, Vectorize RAG, WebSocket stream processing and framework applications.[1]
When not to migrate yet
Keep the current host or run a proof of concept first when the application requires:
- an unsupported native package;
- long-running OS processes or subprocesses;
- assumptions about a persistent writable local filesystem;
- a networking library that only supports blocking requests;
- exact CPython or system-library behavior not available through Pyodide;
- a complex Django stack whose plugins have not been tested under WebAssembly.
Cloudflare says Python Workers run through Pyodide, which is CPython compiled to WebAssembly and executed inside a V8 isolate.[3] That architecture is powerful, but it is not the same as a Linux virtual machine or container.
Production readiness checklist
Before moving traffic:
- pin the compatibility date;
- lock dependencies;
- verify every native dependency;
- store secrets with Worker secrets or bindings;
- add a
/healthendpoint; - test failure and timeout behavior;
- inspect logs and observability data;
- check bundle and platform limits in the current Cloudflare documentation;
- deploy to a staging route first;
- keep a rollback version;
- run an external HTTP smoke test after deployment.
GA means Cloudflare supports the language for production use. It does not remove the need to test the specific framework, packages, database and bindings used by your application.
FAQ
Are Cloudflare Python Workers generally available?
Yes. Cloudflare announced general availability on September 21, 2026 and describes Python as a first-class, fully supported language on its Developer Platform.[1]
Do Python Workers run native CPython?
They use Pyodide: CPython compiled to WebAssembly, running inside a V8 isolate.[3]
Can I deploy FastAPI to Cloudflare Workers?
Yes. Cloudflare provides a workers.asgi connector and documents FastAPI as a supported framework.[1][2]
Do I need Uvicorn or Gunicorn?
Not inside the deployed Worker. The Workers platform handles incoming connections, and the ASGI or WSGI connector bridges those requests to the Python application.[1]
Can I use any PyPI package?
No. Pure-Python packages are supported, as are compatible PyEmscripten and Pyodide packages, but some native-extension packages still lack a WebAssembly-compatible build.[4]
How do I deploy a Python Worker?
Initialize with uvx --from workers-py pywrangler init, test with uv run pywrangler dev, and deploy with uv run pywrangler deploy.[2]
Sources
[1] https://blog.cloudflare.com/python-workers-ga
[2] https://developers.cloudflare.com/workers/languages/python
[3] https://developers.cloudflare.com/workers/languages/python/how-python-workers-work
[4] https://developers.cloudflare.com/workers/languages/python/packages