---
title: Durable Objects are now supported in Python Workers
description: You can now create Durable Objects using Python
image: https://edgetunnel-b2h.pages.dev/changelog-preview.png
---

> Documentation Index  
> Fetch the complete documentation index at: https://edgetunnel-b2h.pages.dev/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://edgetunnel-b2h.pages.dev/changelog/rss/index.xml) [ View RSS feeds ](https://edgetunnel-b2h.pages.dev/fundamentals/new-features/available-rss-feeds/) 

![hero image](https://edgetunnel-b2h.pages.dev/_astro/hero.CVYJHPAd_26AMqX.svg) 

[ ← Back to all posts ](https://edgetunnel-b2h.pages.dev/changelog/) 

## Durable Objects are now supported in Python Workers

May 16, 2025 

[ Workers ](https://edgetunnel-b2h.pages.dev/workers/)[ Durable Objects ](https://edgetunnel-b2h.pages.dev/durable-objects/) 

You can now create [Durable Objects](https://edgetunnel-b2h.pages.dev/durable-objects/) using [Python Workers](https://edgetunnel-b2h.pages.dev/workers/languages/python/). A Durable Object is a special kind of Cloudflare Worker which uniquely combines compute with storage, enabling stateful long-running applications which run close to your users. For more info see [here](https://edgetunnel-b2h.pages.dev/durable-objects/concepts/what-are-durable-objects/).

You can define a Durable Object in Python in a similar way to JavaScript:

**Python**

```python
from workers import DurableObject, Response, WorkerEntrypoint


from urllib.parse import urlparse


class MyDurableObject(DurableObject):
    def __init__(self, ctx, env):
        self.ctx = ctx
        self.env = env


    def fetch(self, request):
        result = self.ctx.storage.sql.exec("SELECT 'Hello, World!' as greeting").one()
        return Response(result.greeting)


class Default(WorkerEntrypoint):
    async def fetch(self, request):
        url = urlparse(request.url)
        id = env.MY_DURABLE_OBJECT.idFromName(url.path)
        stub = env.MY_DURABLE_OBJECT.get(id)
        greeting = await stub.fetch(request.url)
        return greeting
```

Define the Durable Object in your Wrangler configuration file:

* [  wrangler.jsonc ](#tab-panel-2913)
* [  wrangler.toml ](#tab-panel-2914)

**JSONC**

```jsonc
{
  "durable_objects": {
    "bindings": [
      {
        "name": "MY_DURABLE_OBJECT",
        "class_name": "MyDurableObject"
      }
    ]
  }
}
```

**TOML**

```toml
[[durable_objects.bindings]]
name = "MY_DURABLE_OBJECT"
class_name = "MyDurableObject"
```

Then define the storage backend for your Durable Object:

* [  wrangler.jsonc ](#tab-panel-2915)
* [  wrangler.toml ](#tab-panel-2916)

**JSONC**

```jsonc
{
  "migrations": [
    {
      "tag": "v1", // Should be unique for each entry
      "new_sqlite_classes": [ // Array of new classes
        "MyDurableObject"
      ]
    }
  ]
}
```

**TOML**

```toml
[[migrations]]
tag = "v1"
new_sqlite_classes = [ "MyDurableObject" ]
```

Then test your new Durable Object locally by running `wrangler dev`:

```bash
npx wrangler dev
```

Consult the [Durable Objects documentation](https://edgetunnel-b2h.pages.dev/durable-objects/) for more details.

```json
{"@context":"https://schema.org","@type":"BlogPosting","@id":"https://edgetunnel-b2h.pages.dev/changelog/post/2025-05-14-python-worker-durable-object/#page","headline":"Durable Objects are now supported in Python Workers · Changelog","description":"You can now create Durable Objects using Python","url":"https://edgetunnel-b2h.pages.dev/changelog/post/2025-05-14-python-worker-durable-object/","inLanguage":"en","image":"https://edgetunnel-b2h.pages.dev/changelog-preview.png","dateModified":"2025-05-16","datePublished":"2025-05-16","publisher":{"@type":"Organization","name":"Cloudflare","url":"https://www.cloudflare.com/"},"isPartOf":{"@type":"WebSite","@id":"https://edgetunnel-b2h.pages.dev/#website","name":"Cloudflare Docs","url":"https://edgetunnel-b2h.pages.dev/"}}
```
