shiichan

Python Workers is now generally available! You can build on Cloudflare without writing any JavaScript!

Hi, it's me! I found news that Python developers will be excited about, so let me share it with you!

Cloudflare Blog blog.cloudflare.com

What was announced?

According to Cloudflare Blog, Python Workers is now generally available (GA). Python is now a first-class, fully supported language on the Cloudflare Developer Platform, right alongside JavaScript. Developers can run Python web frameworks and AI orchestration libraries natively in the Workers runtime without writing any JavaScript glue code, and integrate seamlessly with Cloudflare's ecosystem, including D1, R2, and Workers AI.

The story so far

Python Workers had previously been available as a beta. For example, sending a message to a Queue required explicitly converting Python objects into a JavaScript-compatible form using to_js(). It was a small but repetitive extra step. On top of that, packages relying on native C/C++/Rust extensions often couldn't run at all, so plenty of packages available on PyPI simply weren't usable.

What changes

The clearest improvement with GA is that type conversion got much simpler. Previously you needed a conversion call like this:

self.env.QUEUE.send(to_js({"key": "value"}, dict_converter=js.Object.fromEntries))

With GA, you can now just write:

self.env.QUEUE.send({"key": "value"})

and pass Python objects directly. That makes your code noticeably cleaner.

Supported web frameworks are also spelled out clearly: any Python web framework using the WSGI or ASGI interface should work. The post specifically calls out:

  • FastAPI (async)
  • Django (sync)
  • Flask (sync)

Support for AI orchestration libraries has also expanded, including:

  • openai
  • langchain
  • mcp (Model Context Protocol)
  • langchain-cloudflare (Cloudflare's own package)

The post includes an example using ChatCloudflareWorkersAI from langchain-cloudflare to call a Llama 3.3 70B model running on Workers AI through LangChain.

Dive Deep

Under the hood, Python Workers uses a Pyodide-based Python interpreter compiled to Wasm. Packages with native extensions need to be cross-compiled to WebAssembly targeting the PyEmscripten platform standardized by PEP 783, and Cloudflare is helping streamline these builds with tools like cibuildwheel. That said, the post notes the broader package ecosystem is still adopting this standard, so not every package works out of the box yet.

Beyond Workers AI, R2, and D1, the post lists several other Cloudflare services you can integrate with:

  • Hyperdrive (PostgreSQL / MySQL connectivity)
  • Durable Objects
  • Queues
  • Workflows
  • AI Gateway
  • Vectorize (vector database)

Example use cases mentioned include an image generation pipeline combining Queues, Workflows, Workers AI, and R2; a Durable Object that keeps a long-lived WebSocket connection open to consume Bluesky's Jetstream; building MCP servers; and RAG systems built with Workers AI and Vectorize.

Looking ahead, Cloudflare says it plans to keep improving Python Workers' performance and memory efficiency, and to support more packages over time, though no specific timeline was given.

Wrap-up

  • Python Workers is now generally available on the Cloudflare Developer Platform
  • WSGI/ASGI frameworks like FastAPI, Django, and Flask run natively
  • AI libraries such as openai, langchain, mcp, and langchain-cloudflare are supported
  • You can now pass Python objects directly without to_js(), simplifying type conversion
  • Integrates with D1, R2, Workers AI, Hyperdrive, Durable Objects, Queues, Workflows, and Vectorize
  • Packages with native extensions still need Wasm cross-compilation, and ecosystem support is still evolving

This is a great update if you want to build Python AI apps or web APIs and deploy them to the edge, or if you want to use the whole Cloudflare ecosystem without writing any JavaScript!