---
title: Python Workers handlers now live in an entrypoint class
description: We are changing how Python Workers are structured by default.
image: https://developers.cloudflare.com/changelog-preview.png
---

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/changelog/llms.txt  
> Use this file to discover all available pages before exploring further. 

[Skip to content](#%5Ftop) 

# Changelog

New updates and improvements at Cloudflare.

[ Subscribe to RSS ](https://developers.cloudflare.com/changelog/rss/index.xml) [ View RSS feeds ](https://developers.cloudflare.com/fundamentals/new-features/available-rss-feeds/) 

![hero image](https://developers.cloudflare.com/_astro/hero.CVYJHPAd_26AMqX.svg) 

[ ← Back to all posts ](https://developers.cloudflare.com/changelog/) 

## Python Workers handlers now live in an entrypoint class

Aug 14, 2025 

[ Workers ](https://developers.cloudflare.com/workers/) 

We are changing how Python Workers are structured by default. Previously, handlers were defined at the top-level of a module as `on_fetch`, `on_scheduled`, etc. methods, but now they live in an entrypoint class.

Here's an example of how to now define a Worker with a fetch handler:

**Python**

```python
from workers import Response, WorkerEntrypoint


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

To keep using the old-style handlers, you can specify the `disable_python_no_global_handlers` compatibility flag in your wrangler file:

* [  wrangler.jsonc ](#tab-panel-2731)
* [  wrangler.toml ](#tab-panel-2732)

**JSONC**

```jsonc
{
  "compatibility_flags": [
    "disable_python_no_global_handlers"
  ]
}
```

**TOML**

```toml
compatibility_flags = [ "disable_python_no_global_handlers" ]
```

Consult the [Python Workers documentation](https://developers.cloudflare.com/workers/languages/python/) for more details.

```json
{"@context":"https://schema.org","@type":"BlogPosting","@id":"https://developers.cloudflare.com/changelog/post/2025-08-14-new-python-handlers/#page","headline":"Python Workers handlers now live in an entrypoint class · Changelog","description":"We are changing how Python Workers are structured by default.","url":"https://developers.cloudflare.com/changelog/post/2025-08-14-new-python-handlers/","inLanguage":"en","image":"https://developers.cloudflare.com/changelog-preview.png","dateModified":"2025-08-14","datePublished":"2025-08-14","publisher":{"@type":"Organization","name":"Cloudflare","url":"https://www.cloudflare.com/"},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```
