Metadata-Version: 2.4
Name: pydocket
Version: 0.16.3
Summary: A distributed background task system for Python functions
Project-URL: Homepage, https://github.com/chrisguidry/docket
Project-URL: Bug Tracker, https://github.com/chrisguidry/docket/issues
Author-email: Chris Guidry <guid@omg.lol>
License: # Released under MIT License
Copyright (c) 2025 Chris Guidry.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: cloudpickle>=3.1.1
Requires-Dist: exceptiongroup>=1.2.0; python_version < '3.11'
Requires-Dist: fakeredis[lua]>=2.32.1
Requires-Dist: opentelemetry-api>=1.33.0
Requires-Dist: opentelemetry-exporter-prometheus>=0.60b0
Requires-Dist: opentelemetry-instrumentation>=0.60b0
Requires-Dist: prometheus-client>=0.21.1
Requires-Dist: py-key-value-aio[memory,redis]>=0.3.0
Requires-Dist: python-json-logger>=2.0.7
Requires-Dist: redis>=5
Requires-Dist: rich>=13.9.4
Requires-Dist: typer>=0.15.1
Requires-Dist: typing-extensions>=4.12.0
Description-Content-Type: text/markdown
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.
[](https://pypi.org/project/pydocket/)
[](https://pypi.org/project/pydocket/)
[](https://github.com/chrisguidry/docket/actions/workflows/ci.yml)
[](https://app.codecov.io/gh/chrisguidry/docket)
[](https://github.com/chrisguidry/docket/blob/main/LICENSE)
[](https://chrisguidry.github.io/docket/)
## At a glance
```python
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")
```
```python
from docket import Docket, Worker
async with Docket() as docket:
async with Worker(docket) as worker:
worker.register(greet)
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](http://chrisguidry.github.io/docket/),
[examples](https://chrisguidry.github.io/docket/getting-started/), and the [API
reference](https://chrisguidry.github.io/docket/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](https://pypi.org/project/pydocket/) under the package name
`pydocket`. It targets Python 3.10 or above.
With [`uv`](https://docs.astral.sh/uv/):
```bash
uv pip install pydocket
or
uv add pydocket
```
With `pip`:
```bash
pip install pydocket
```
Docket requires a [Redis](http://redis.io/) server with Streams support (which was
introduced in Redis 5.0.0). Docket is tested with Redis 6, 7, and 8.
For testing without Redis, Docket includes [fakeredis](https://github.com/cunla/fakeredis-py) for in-memory operation:
```python
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](https://chrisguidry.github.io/docket/testing/#using-in-memory-backend-no-redis-required) for more details.
# Hacking on `docket`
We use [`uv`](https://docs.astral.sh/uv/) for project management, so getting set up
should be as simple as cloning the repo and running:
```bash
uv sync
```
The to run the test suite:
```bash
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.