[ Web Proxy ]
URL:
Viewing: https://developers.cloudflare.com/workers/languages/python/ [Back]  [Original]

Write Cloudflare Workers in Python Cloudflare Workers docsSkip to content
SearchCtrlKLog in
  1. Home
  2. /Workers
  3. /Languages
  4. /Python Workers

Python Workers

Last updated Jun 22, 2026Copy as MarkdownView as MarkdownAgent setup
OverviewIntroductionThe pywrangler CLI toolPython Worker TemplatesNext Up

Cloudflare Workers provides a first-class Python experience, including support for:

Introduction

A Python Worker can be as simple as four lines of code:

from workers import WorkerEntrypoint, Response

class Default(WorkerEntrypoint):
    async def fetch(self, request):
        return Response("Hello World!")

Similar to other Workers, the main entry point for a Python worker is the fetch handler which handles incoming requests sent to the Worker.

In a Python Worker, this handler is placed in a Default class that extends the WorkerEntrypoint class (which you can import from the workers SDK module).

Python Workers are in beta.

You must add the python_workers compatibility flag to your Worker, while Python Workers are in open beta.

We'd love your feedback. Join the #python-workers channel in the Cloudflare Developers Discord and let us know what you'd like to see next.

The pywrangler CLI tool

To run a Python Worker locally, install packages, and deploy it to Cloudflare, you use pywrangler , the CLI for Python Workers.

To set it up, first, ensure uv and Node are installed.

Then set up your development environment:

uvx --from workers-py pywrangler init

This will create a pyproject.toml file with workers-py as a development dependency. pywrangler init will create a wrangler config file. You can then run pywrangler with:

uv run pywrangler dev

To deploy a Python Worker to Cloudflare, run pywrangler deploy:

uv run pywrangler deploy

Python Worker Templates

When you initialize a new Python Worker project and select from one of many templates:

uv run pywrangler init

Or you can clone the examples repository to explore more options:

git clone https://github.com/cloudflare/python-workers-examples
cd python-workers-examples/01-hello

Next Up

PreviousExamples NextThe Basics

Was this helpful?

YesNo
Edit pageReport issue
[]

Web Proxy Viewer  |  New URL  |  Original Page