Skip to main content

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:
    docket.register(greet)
    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

💉 Dependency injection like FastAPI, Typer, and FastMCP for reusable resources

Installing docket

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

With uv:

uv pip install pydocket

or

uv add pydocket

With pip:

pip install pydocket

Docket requires Redis 6.2 or later, or Valkey 8.0 or later. Docket is tested with:

  • Redis 6.2 and 8.10, and Redis 8.10 in cluster mode
  • Valkey 8.0 and 9.1
  • In-memory backend via burner-redis for testing

For testing without Redis, use the in-memory backend:

from docket import Docket

async with Docket(name="my-docket", url="memory://my-docket") as docket:
    # Use docket normally - all operations are in-memory
    ...

See Testing with Docket for more details.

Hacking on docket

We use uv for project management. The repository is a uv workspace, and the Python package lives in its python/ directory. From a clone of the repository:

uv sync
cd python
uv run 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.

To work on the documentation locally, from the repository root:

uv sync
uv run zensical serve

This will start a local preview server. The docs are built with Zensical and configured in mkdocs.yml.

Metadata

Release files for pydocket 0.27.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydocket 0.27.2
File Size Uploaded Provenance Actions
pydocket-0.27.2.tar.gz 333.5 kB With provenance Details for pydocket-0.27.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydocket 0.27.2
File Interpreter ABI Platform Actions
pydocket-0.27.2-py3-none-any.whl Python 3 none any Details for pydocket-0.27.2-py3-none-any.whl

Total release size: 489.8 kB

Release files / pydocket-0.27.2.tar.gz

Download URL pydocket-0.27.2.tar.gz
Size 333.5 kB
Tags Source
SHA-256 checksum
How to use checksums
472c1f91c1b3940c639aab37b2272f4504f8400d6d8956a13d508925d847f234
BLAKE2b-256 checksum
How to use checksums
3fe2b430c83b1388c3a28e171eeaade1fadb67e0d528ac13437906cae82a154a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / pydocket-0.27.2-py3-none-any.whl

Download URL pydocket-0.27.2-py3-none-any.whl
Size 156.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3aea41bf457e1285d3c932beb714754fbfbf047db6406d75114e37bed3f5eb6
BLAKE2b-256 checksum
How to use checksums
8be54eb4f658d2712c88da3ac9d1ad6fc662dd077cb38f90c6bd9792dc3c61bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for pydocket 0.27.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pydocket-0.27.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.27.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page