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.1

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.1
File Size Uploaded Provenance Actions
pydocket-0.27.1.tar.gz 331.7 kB With provenance Details for pydocket-0.27.1.tar.gz

Built distribution (wheel)

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

Total release size: 487.3 kB

Release files / pydocket-0.27.1.tar.gz

Download URL pydocket-0.27.1.tar.gz
Size 331.7 kB
Tags Source
SHA-256 checksum
How to use checksums
762c6f4f107a938d42e6a7750756ebb57b52e59adc8155649f65b5d43d8be331
BLAKE2b-256 checksum
How to use checksums
179763c00c69667205d07dd9c685d84145e1281e4144bf036ccd682c608e97b0
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 Oct 27, 2026.

Transparency log

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

Download URL pydocket-0.27.1-py3-none-any.whl
Size 155.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8cd40e15cdf55eda980945e8c7fb8ca6e2365895f27f0d55e96e92d04a015bc
BLAKE2b-256 checksum
How to use checksums
0e0fc3359b0e7ae519d24a657d2176d9d77f2166cd6da715f84cf8ea4eba7bbb
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 Oct 27, 2026.

Transparency log

Security for pydocket 0.27.1

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.1.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 Oct 27, 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.1 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