pydocket 0.15.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docket/__init__.py +55 -0
- docket/__main__.py +3 -0
- docket/_uuid7.py +99 -0
- docket/agenda.py +202 -0
- docket/annotations.py +81 -0
- docket/cli.py +1185 -0
- docket/dependencies.py +808 -0
- docket/docket.py +1062 -0
- docket/execution.py +1370 -0
- docket/instrumentation.py +225 -0
- docket/py.typed +0 -0
- docket/tasks.py +59 -0
- docket/testing.py +235 -0
- docket/worker.py +1071 -0
- pydocket-0.15.3.dist-info/METADATA +160 -0
- pydocket-0.15.3.dist-info/RECORD +19 -0
- pydocket-0.15.3.dist-info/WHEEL +4 -0
- pydocket-0.15.3.dist-info/entry_points.txt +2 -0
- pydocket-0.15.3.dist-info/licenses/LICENSE +9 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pydocket
|
|
3
|
+
Version: 0.15.3
|
|
4
|
+
Summary: A distributed background task system for Python functions
|
|
5
|
+
Project-URL: Homepage, https://github.com/chrisguidry/docket
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/chrisguidry/docket/issues
|
|
7
|
+
Author-email: Chris Guidry <guid@omg.lol>
|
|
8
|
+
License: # Released under MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2025 Chris Guidry.
|
|
11
|
+
|
|
12
|
+
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:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
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.
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Classifier: Development Status :: 4 - Beta
|
|
19
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
27
|
+
Classifier: Typing :: Typed
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Requires-Dist: cloudpickle>=3.1.1
|
|
30
|
+
Requires-Dist: exceptiongroup>=1.2.0; python_version < '3.11'
|
|
31
|
+
Requires-Dist: fakeredis[lua]>=2.32.1
|
|
32
|
+
Requires-Dist: opentelemetry-api>=1.30.0
|
|
33
|
+
Requires-Dist: opentelemetry-exporter-prometheus>=0.51b0
|
|
34
|
+
Requires-Dist: prometheus-client>=0.21.1
|
|
35
|
+
Requires-Dist: py-key-value-aio[memory,redis]>=0.3.0
|
|
36
|
+
Requires-Dist: python-json-logger>=2.0.7
|
|
37
|
+
Requires-Dist: redis>=5
|
|
38
|
+
Requires-Dist: rich>=13.9.4
|
|
39
|
+
Requires-Dist: typer>=0.15.1
|
|
40
|
+
Requires-Dist: typing-extensions>=4.12.0
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
43
|
+
Docket is a distributed background task system for Python functions with a focus
|
|
44
|
+
on the scheduling of future work as seamlessly and efficiently as immediate work.
|
|
45
|
+
|
|
46
|
+
[](https://pypi.org/project/pydocket/)
|
|
47
|
+
[](https://pypi.org/project/pydocket/)
|
|
48
|
+
[](https://github.com/chrisguidry/docket/actions/workflows/ci.yml)
|
|
49
|
+
[](https://app.codecov.io/gh/chrisguidry/docket)
|
|
50
|
+
[](https://github.com/chrisguidry/docket/blob/main/LICENSE)
|
|
51
|
+
[](https://chrisguidry.github.io/docket/)
|
|
52
|
+
|
|
53
|
+
## At a glance
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from datetime import datetime, timedelta, timezone
|
|
57
|
+
|
|
58
|
+
from docket import Docket
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
async def greet(name: str, greeting="Hello") -> None:
|
|
62
|
+
print(f"{greeting}, {name} at {datetime.now()}!")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
async with Docket() as docket:
|
|
66
|
+
await docket.add(greet)("Jane")
|
|
67
|
+
|
|
68
|
+
now = datetime.now(timezone.utc)
|
|
69
|
+
soon = now + timedelta(seconds=3)
|
|
70
|
+
await docket.add(greet, when=soon)("John", greeting="Howdy")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from docket import Docket, Worker
|
|
75
|
+
|
|
76
|
+
async with Docket() as docket:
|
|
77
|
+
async with Worker(docket) as worker:
|
|
78
|
+
worker.register(greet)
|
|
79
|
+
await worker.run_until_finished()
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
Hello, Jane at 2025-03-05 13:58:21.552644!
|
|
84
|
+
Howdy, John at 2025-03-05 13:58:24.550773!
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Check out our docs for more [details](http://chrisguidry.github.io/docket/),
|
|
88
|
+
[examples](https://chrisguidry.github.io/docket/getting-started/), and the [API
|
|
89
|
+
reference](https://chrisguidry.github.io/docket/api-reference/).
|
|
90
|
+
|
|
91
|
+
## Why `docket`?
|
|
92
|
+
|
|
93
|
+
⚡️ Snappy one-way background task processing without any bloat
|
|
94
|
+
|
|
95
|
+
📅 Schedule immediate or future work seamlessly with the same interface
|
|
96
|
+
|
|
97
|
+
⏭️ Skip problematic tasks or parameters without redeploying
|
|
98
|
+
|
|
99
|
+
🌊 Purpose-built for Redis streams
|
|
100
|
+
|
|
101
|
+
🧩 Fully type-complete and type-aware for your background task functions
|
|
102
|
+
|
|
103
|
+
💉 Dependency injection like FastAPI, Typer, and FastMCP for reusable resources
|
|
104
|
+
|
|
105
|
+
## Installing `docket`
|
|
106
|
+
|
|
107
|
+
Docket is [available on PyPI](https://pypi.org/project/pydocket/) under the package name
|
|
108
|
+
`pydocket`. It targets Python 3.10 or above.
|
|
109
|
+
|
|
110
|
+
With [`uv`](https://docs.astral.sh/uv/):
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
uv pip install pydocket
|
|
114
|
+
|
|
115
|
+
or
|
|
116
|
+
|
|
117
|
+
uv add pydocket
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
With `pip`:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
pip install pydocket
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Docket requires a [Redis](http://redis.io/) server with Streams support (which was
|
|
127
|
+
introduced in Redis 5.0.0). Docket is tested with Redis 6, 7, and 8.
|
|
128
|
+
|
|
129
|
+
For testing without Redis, Docket includes [fakeredis](https://github.com/cunla/fakeredis-py) for in-memory operation:
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
from docket import Docket
|
|
133
|
+
|
|
134
|
+
async with Docket(name="my-docket", url="memory://my-docket") as docket:
|
|
135
|
+
# Use docket normally - all operations are in-memory
|
|
136
|
+
...
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
See [Testing with Docket](https://chrisguidry.github.io/docket/testing/#using-in-memory-backend-no-redis-required) for more details.
|
|
140
|
+
|
|
141
|
+
# Hacking on `docket`
|
|
142
|
+
|
|
143
|
+
We use [`uv`](https://docs.astral.sh/uv/) for project management, so getting set up
|
|
144
|
+
should be as simple as cloning the repo and running:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
uv sync
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The to run the test suite:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
pytest
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
We aim to maintain 100% test coverage, which is required for all PRs to `docket`. We
|
|
157
|
+
believe that `docket` should stay small, simple, understandable, and reliable, and that
|
|
158
|
+
begins with testing all the dusty branches and corners. This will give us the
|
|
159
|
+
confidence to upgrade dependencies quickly and to adapt to new versions of Redis over
|
|
160
|
+
time.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
docket/__init__.py,sha256=8cIyryosca3sCJ-789lYh9428ZvhYYd5BkznbXmvnWg,1061
|
|
2
|
+
docket/__main__.py,sha256=wcCrL4PjG51r5wVKqJhcoJPTLfHW0wNbD31DrUN0MWI,28
|
|
3
|
+
docket/_uuid7.py,sha256=CMcERw6A-8829JVDIlL-gDnbNmJeDtCRQT_69E_qdwU,3969
|
|
4
|
+
docket/agenda.py,sha256=5Q2Nd2_MZOwSAjs7mO035Z1ZgdjSSPOQi88OR28KJmY,6690
|
|
5
|
+
docket/annotations.py,sha256=enTC_b76hxEFbsas3236ihqA8C5Ijvff8PSb2WM8og0,2378
|
|
6
|
+
docket/cli.py,sha256=CxQvlyoF4jkfIaSWswUbbEigwt-8piHNe7y6sxRdyBw,38183
|
|
7
|
+
docket/dependencies.py,sha256=jHoazzO1wCaX1fj-yVamBbST-XCJ45D4alYaqDaE7l0,25701
|
|
8
|
+
docket/docket.py,sha256=7DotiLQ8pPUKCxgdXzIAffaqjFHHxTI51TrwTQS1yUc,37874
|
|
9
|
+
docket/execution.py,sha256=OorARLM6Lwq4QtRqhXpazc3xJw-lCZSCusX-ASQ7tHw,52905
|
|
10
|
+
docket/instrumentation.py,sha256=k5yogK3GEGeU6zFWsOv3ENBS2li0jhVQ2BdON8Ov7uM,5908
|
|
11
|
+
docket/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
docket/tasks.py,sha256=FzgLNPS_Q370auMSdHmuQxGsHM_GbWuzT-Lja0zAJWs,1441
|
|
13
|
+
docket/testing.py,sha256=gqccJ102CgvYgGQeKfRLReH2CWrI6iakyt0onsYvKRM,7236
|
|
14
|
+
docket/worker.py,sha256=gRt0ZQ64w5aM37jXtU1eCRnpFQB6Cu9KTwHT0izxPwc,42512
|
|
15
|
+
pydocket-0.15.3.dist-info/METADATA,sha256=DRClkiN29lX2qEFnaHk-oQKWRr5deUeZONwKj60HAOc,6205
|
|
16
|
+
pydocket-0.15.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
17
|
+
pydocket-0.15.3.dist-info/entry_points.txt,sha256=4WOk1nUlBsUT5O3RyMci2ImuC5XFswuopElYcLHtD5k,47
|
|
18
|
+
pydocket-0.15.3.dist-info/licenses/LICENSE,sha256=YuVWU_ZXO0K_k2FG8xWKe5RGxV24AhJKTvQmKfqXuyk,1087
|
|
19
|
+
pydocket-0.15.3.dist-info/RECORD,,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Released under MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Chris Guidry.
|
|
4
|
+
|
|
5
|
+
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:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
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.
|