Skip to main content

A distributed background task system for Python functions

Project description

Docket is a distributed background task system for Python functions with a focus on the scheduling of future work as seamlessly and efficiently as immediate work.

PyPI - Version PyPI - Python Version GitHub main checks Codecov PyPI - License Documentation

At a glance

from datetime import datetime, timedelta, timezone

from docket import Docket


async def greet(name: str, greeting="Hello") -> None:
    print(f"{greeting}, {name} at {datetime.now()}!")


async with Docket() as docket:
    await docket.add(greet)("Jane")

    now = datetime.now(timezone.utc)
    soon = now + timedelta(seconds=3)
    await docket.add(greet, when=soon)("John", greeting="Howdy")
from docket import Docket, Worker

async with Docket() as docket:
    async with Worker(docket) as worker:
        await worker.run_until_finished()
Hello, Jane at 2025-03-05 13:58:21.552644!
Howdy, John at 2025-03-05 13:58:24.550773!

Check out our docs for more details, examples, and the API reference.

Why docket?

⚡️ Snappy one-way background task processing without any bloat

📅 Schedule immediate or future work seamlessly with the same interface

⏭️ Skip problematic tasks or parameters without redeploying

🌊 Purpose-built for Redis streams

🧩 Fully type-complete and type-aware for your background task functions

Installing docket

Docket is available on PyPI under the package name pydocket. It targets Python 3.12 or above.

With uv:

uv pip install pydocket

or

uv add pydocket

With pip:

pip install pydocket

Docket requires a Redis server with Streams support (which was introduced in Redis 5.0.0). Docket is tested with Redis 6 and 7.

Hacking on docket

We use uv for project management, so getting set up should be as simple as cloning the repo and running:

uv sync

The to run the test suite:

pytest

We aim to maintain 100% test coverage, which is required for all PRs to docket. We believe that docket should stay small, simple, understandable, and reliable, and that begins with testing all the dusty branches and corners. This will give us the confidence to upgrade dependencies quickly and to adapt to new versions of Redis over time.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydocket-0.7.0.tar.gz (100.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydocket-0.7.0-py3-none-any.whl (31.9 kB view details)

Uploaded Python 3

File details

Details for the file pydocket-0.7.0.tar.gz.

File metadata

  • Download URL: pydocket-0.7.0.tar.gz
  • Upload date:
  • Size: 100.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.5

File hashes

Hashes for pydocket-0.7.0.tar.gz
Algorithm Hash digest
SHA256 98756125ee016fb5a46ab2b7f6c1a931680af64e378cf4de84467d8b4612b247
MD5 885364f760ec3b490fb592c5bfa0b027
BLAKE2b-256 6c5599bc93b72e069487eeef711ad84c3044996b0b4b5dcc9a554bc5fefed446

See more details on using hashes here.

File details

Details for the file pydocket-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: pydocket-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 31.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.5

File hashes

Hashes for pydocket-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9d4c8f9feac8917f342f025ee52e6a72cdc8f5d98eedd22adddcae1dc28e9ee
MD5 aee503e65643dbac453cc51061857c98
BLAKE2b-256 acf83729581e5f14739515c493bf7bdd68d0e1dfb6ea7f6ac9b145aef37c0ee0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page