logo
Kurashizu Blogwhere ideas flow
  • Home
  • News
  • Blog
  • About
  • Home
  • News
  • Blog
  • About

© 2026 Kurashizu. All rights reserved.

Admin·New Post·Service Status
Powered by Cloudflare·31.10.26
← Back to news

Python Workers are now generally available

Original article
blog.cloudflare.com|79 points|5 comments|by torutofu|Sep 21, 2026

Python Workers: Now Generally Available

Date: September 21, 2026
Authors: Gyeongjae Choi, Dominik Picheta, and Hood Chatham
Reading Time: ≈10\approx 10≈10 minutes

Two years ago, Cloudflare introduced Python Workers to enable the execution of Python applications directly within the Workers runtime. Today, we are thrilled to announce that Python Workers are now Generally Available (GA).

Our primary objective was to ensure that developing Workers in Python is as seamless as it is in TypeScript, ensuring that the vast ecosystem of Python frameworks and packages "just work" out of the box.

🚀 A First-Class Citizen on the Developer Platform

Python is no longer just an experimental addition; it is now a fully supported, first-class language. This means you can leverage your existing Python expertise, libraries, and architectural patterns and integrate them directly with the Cloudflare ecosystem.

Integrated Services

Python Workers connect effortlessly to:

  • Workers AI (Machine Learning)
  • R2 (Object Storage)
  • D1 (SQL Database)
  • Hyperdrive (Database Acceleration)
  • Durable Objects (State Management)
  • Queues & Workflows (Async Processing)

Furthermore, you can utilize Dynamic Workers to instantiate a Python Worker from within another Worker.

Example: FastAPI + Workers AI

from fastapi import FastAPI, Request 
from workers import asgi, WorkerEntrypoint 

app = FastAPI() 

@app.get("/") 
async def root(request: Request): 
    # Accessing the environment via request scope
    env = request.scope["env"] 
    return await env.AI.run(
        "@cf/openai/gpt-oss-120b", 
        { 
            "instructions": "You are a friendly assistant.", 
            "input": "What is the origin of the phrase Hello, World?", 
        }, 
    ) 

# Set the entrypoint for the Worker
Default = asgi.entrypoint(app)

🛠️ The Engineering Journey

The decision to bring Python to the platform was driven by the fact that Workers has supported WebAssembly (Wasm) since 2018. This provided the ideal foundation to run a Wasm-compiled Python interpreter.

By leveraging Pyodide, we rapidly expanded support for various Python applications. Our mission was to build a platform for Scalability→∞\text{Scalability} \to \inftyScalability→∞ while maintaining the performance and developer experience found in traditional Python environments.

Evolution of Bindings

Previously, interacting with Cloudflare bindings required manual type conversion at the RPC boundary.

The "Old" Way (Manual Conversion): from pyodide.ffi import to_js import js self.env.QUEUE.send(to_js({"key": "value"}, dict_converter=js.Object.fromEntries))

The "New" Way (Native Pythonic): self.env.QUEUE.send({"key": "value"})

FeaturePrevious StateCurrent GA State
Type ConversionManual via to_jsAutomatic/Internal
Developer ExperienceRequired JS knowledgePure Python
Error RateHigher (Human/AI errors)Significantly Lower

🌐 Supporting Web Frameworks: FastAPI, Django, and Flask

You can now deploy your favorite web frameworks directly to the edge. Cloudflare provides built-in connectors to bridge the gap between the Workers runtime and Python's web standards.

Implementation Logic

In a standard environment, you would use a server like uvicorn: $ uvicorn main:app

In Python Workers, you use the workers.asgi (for async) or workers.wsgi (for sync) packages.

For Async (FastAPI):

from workers import asgi, WorkerEntrypoint

class Default(WorkerEntrypoint): 
    async def fetch(self, request): 
        return await asgi.fetch(app, request, self.env)

For Sync (Django):

from workers import WorkerEntrypoint, wsgi 
from your_django_app.wsgi import app 

Default = wsgi.entrypoint(app)

How it Works Under the Hood

Python relies on standard interfaces: WSGI (Web Server Gateway Interface) and ASGI (Asynchronous Server Gateway Interface). These allow apps to remain server-agnostic.

Because Cloudflare's network handles load balancing and scaling automatically, we don't run a heavy server (like Gunicorn) inside the Worker. Instead, the connectors act as a thin, optimized bridge that translates JavaScript requests into the structures Python expects.


📋 Summary Checklist for Developers

  • Install Python environment
  • Choose framework (FastAPI/Django/Flask)
  • Implement asgi.entrypoint or wsgi.entrypoint
  • Connect to Cloudflare Bindings (R2, D1, etc.)
  • Deploy to the global edge

Cloudflare Python Workers Concept

🗄️ Database Connectivity

Finally, for those requiring robust data persistence, Python Workers now integrate seamlessly with PostgreSQL and MySQL via Hyperdrive, ensuring your database connections are optimized for the edge...