Registry / workflow / docket

docket

JSON →
library0.18.2pypypiunverified

Docket is a Python library that provides a distributed background task system for executing Python functions. It is currently at version 0.18.2 and maintains an active development cycle with frequent releases, offering robust solutions for task scheduling and execution.

pip install docket
INSTALL
IMPORT
SIG · DOCKET
D
docket
workflowpythonv0.18.2
Install
—
Import
—
Disk
—
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
build_error
glibc
py 3.10–3.95 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Docket
✓ from docket import Docket
task
✓ from docket import task
Cron
✓ from docket.dependencies import Cron
Used for defining tasks that run on a cron schedule.

A minimal example demonstrating how to define an asynchronous task and run it using Docket. This example uses the default in-memory backend.

import asyncio from docket import Docket, task @task async def greet_task(name: str): """An example asynchronous task.""" print(f"Hello, {name}!") return f"Greeted {name}" async def main(): # Initialize Docket. In a real application, you might configure a backend like Redis. docket = Docket() # Add the task to be run. This queues it for execution. await docket.add(greet_task, name="World") print("Task added. Running Docket...") # Run Docket. In a long-running service, this would be awaited indefinitely. # For a quickstart, we'll run it briefly to allow the task to execute. # For simplicity, we'll assume the task completes quickly. try: await asyncio.wait_for(docket.run(), timeout=5) # Run for max 5 seconds except asyncio.TimeoutError: print("Docket run timed out after 5 seconds.") if __name__ == "__main__": asyncio.run(main())
docket --version
Debug
Known issues
breakingFrom version 0.18.0, Docket's internal dependency system was extracted into the `uncalled-for` library. While intended to be a transparent change for most users, deep or custom integrations with Docket's dependency resolution might require review.
fix
No direct code changes are typically required, as `uncalled-for` is installed as a dependency of `docket`. However, if experiencing issues, ensure `uncalled-for` is correctly installed and consult its documentation if custom dependency injection logic was previously implemented.
affects: 0.18.0+
gotchaDocket tasks are fundamentally asynchronous (`async def`) and rely on `asyncio`. Incorrectly mixing synchronous code in an async task, or blocking the event loop, can lead to performance issues or deadlocks.
fix
Ensure all I/O-bound or long-running operations within tasks are non-blocking or are offloaded to an executor (e.g., `loop.run_in_executor`) to prevent blocking the `asyncio` event loop. Always `await` asynchronous calls.
affects: All versions
gotchaWhen using `Cron` dependencies for task scheduling, ensure careful consideration of timezones. Default behavior might rely on the system's local timezone, which can lead to unexpected execution times in distributed or timezone-aware applications.
fix
Explicitly specify the timezone using the `tz` argument in the `Cron` constructor (e.g., `Cron('0 0 * * *', tz='America/New_York')`). Verify that your system's timezone settings are consistent across all Docket worker nodes.
affects: All versions, improved in 0.17.5
gotchaUsing persistent backends (e.g., Redis, PostgreSQL) requires robust configuration and connection management to ensure tasks are reliably stored, retrieved, and processed across application restarts and distributed environments.
fix
Refer to the Docket documentation for the specific backend chosen. Implement proper connection pooling, error handling, and retry mechanisms for backend connections. Misconfigurations can lead to lost tasks or inconsistent state.
affects: All versions using persistent backends
breakingThe `docket` package could not be found or installed from the available package index (e.g., PyPI). This typically indicates that the package is not published, the package name is misspelled, or the Python environment lacks access to the package index.
fix
Verify the correct package name (`docket`) and ensure it is published to PyPI or your configured package repository. Check network connectivity and `pip` configuration if using private repositories or proxies. If `docket` is not yet released, consider installing directly from source if available.
affects: All versions
gotchaThe `docket` library might not have pre-built wheels or be available for installation on all Python versions or architectures, particularly for newer Python releases (e.g., Python 3.13) or less common operating systems/architectures (e.g., Alpine Linux). This can lead to installation failures.
fix
Before attempting installation, verify Docket's PyPI page or documentation for supported Python versions and available distributions for your target environment. Consider using an officially supported Python version (e.g., 3.8-3.12) if encountering issues with newer releases or specific environments like Alpine Linux.
affects: All versions
Upgrade
Version history
0.18.2latest on PyPI
Audit
Dependencies
uncalled-forrequiredDependency injection and task dependency management were extracted into this separate library in version 0.18.0. It is a core architectural component of Docket.
Agent activity
32 hits · last 30 days
node
28
OpenAI (training)
1
Resources

No resource links recorded.