grindsharp 0.1.0__tar.gz → 0.1.2__tar.gz
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.
- {grindsharp-0.1.0/src/grindsharp.egg-info → grindsharp-0.1.2}/PKG-INFO +48 -32
- {grindsharp-0.1.0 → grindsharp-0.1.2}/README.md +196 -183
- {grindsharp-0.1.0 → grindsharp-0.1.2}/pyproject.toml +50 -45
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp/__init__.py +23 -23
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp/app.py +1 -2
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp/cli.py +11 -3
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp/redis_store.py +0 -1
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp/worker.py +209 -142
- {grindsharp-0.1.0 → grindsharp-0.1.2/src/grindsharp.egg-info}/PKG-INFO +48 -32
- {grindsharp-0.1.0 → grindsharp-0.1.2}/tests/test_grindsharp.py +313 -274
- {grindsharp-0.1.0 → grindsharp-0.1.2}/LICENSE +0 -0
- {grindsharp-0.1.0 → grindsharp-0.1.2}/setup.cfg +0 -0
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp/__main__.py +0 -0
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp/errors.py +0 -0
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp/models.py +0 -0
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp/postgres.py +0 -0
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp/py.typed +0 -0
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp/store.py +0 -0
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp.egg-info/SOURCES.txt +0 -0
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp.egg-info/dependency_links.txt +0 -0
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp.egg-info/entry_points.txt +0 -0
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp.egg-info/requires.txt +0 -0
- {grindsharp-0.1.0 → grindsharp-0.1.2}/src/grindsharp.egg-info/top_level.txt +0 -0
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: grindsharp
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: SQLite-first background jobs for Python. No Redis required.
|
|
5
|
-
Author:
|
|
5
|
+
Author: GT47THY
|
|
6
6
|
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://pypi.org/project/grindsharp/
|
|
8
|
+
Project-URL: Repository, https://pypi.org/project/grindsharp/
|
|
9
|
+
Project-URL: Issues, https://pypi.org/project/grindsharp/
|
|
7
10
|
Keywords: background-jobs,queue,sqlite,worker,tasks,scheduler
|
|
8
|
-
Classifier: Development Status ::
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
12
|
Classifier: Intended Audience :: Developers
|
|
10
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
14
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -21,28 +24,33 @@ Dynamic: license-file
|
|
|
21
24
|
|
|
22
25
|
# Grindsharp
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
SQLite-first background jobs for Python. No Redis required.
|
|
25
28
|
|
|
26
|
-
The usual setup works, but it can be overkill for a small app
|
|
29
|
+
Most Python apps eventually need to do stuff in the background: send an email, process an upload, call a webhook, generate a report, retry something that flopped. The usual setup works, but it can be overkill for a small app - Redis, a broker, worker containers, extra config.
|
|
27
30
|
|
|
28
31
|
Grindsharp is for the common case: you just want background jobs that are reliable and easy to run.
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
## Features
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- A simple `@task` decorator
|
|
35
|
+
- Simple `@task` decorator
|
|
35
36
|
- `enqueue()`, `enqueue_in()`, `enqueue_at()`
|
|
36
37
|
- Retries with backoff
|
|
37
|
-
-
|
|
38
|
+
- Worker process with basic concurrency
|
|
38
39
|
- SQLite-backed job storage (WAL mode)
|
|
39
40
|
- Job status, crash recovery, and idempotent job IDs
|
|
40
|
-
-
|
|
41
|
+
- Small CLI for listing/retrying/stats
|
|
42
|
+
- Optional Postgres/Redis store adapters
|
|
41
43
|
|
|
42
44
|
## Install
|
|
43
45
|
|
|
44
46
|
```bash
|
|
45
|
-
pip install
|
|
47
|
+
pip install grindsharp
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For local development:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install -e .[dev]
|
|
46
54
|
```
|
|
47
55
|
|
|
48
56
|
## Quick start
|
|
@@ -91,7 +99,7 @@ Run a worker:
|
|
|
91
99
|
grindsharp worker --app jobs:jobs --db jobs.db
|
|
92
100
|
```
|
|
93
101
|
|
|
94
|
-
That
|
|
102
|
+
That's it: your web request returns quickly, and the worker handles the job.
|
|
95
103
|
|
|
96
104
|
## FastAPI example
|
|
97
105
|
|
|
@@ -122,9 +130,10 @@ grindsharp worker --app app:jobs --db jobs.db
|
|
|
122
130
|
## How jobs behave
|
|
123
131
|
|
|
124
132
|
- **Durable:** jobs are saved in SQLite, so they survive app restarts.
|
|
125
|
-
- **At-least-once:** if a worker crashes mid-job, that job might run again.
|
|
133
|
+
- **At-least-once:** if a worker crashes mid-job, that job might run again. Write tasks so they're safe to retry.
|
|
126
134
|
- **Retries:** failed jobs retry with backoff (`retry_backoff_seconds * attempt`).
|
|
127
|
-
- **
|
|
135
|
+
- **Timeouts:** if a task sets `timeout_seconds`, the worker marks it as timed out/failed when that limit passes (then it retries or goes dead like any other failure). A stuck Python thread may still keep running in-process, so task code should still respect timeouts/cancellation where it can.
|
|
136
|
+
- **Dead jobs:** when retries run out, the job gets marked `dead` and keeps the last error.
|
|
128
137
|
- **Crash recovery:** stale `running` jobs get moved back to `pending` after a timeout.
|
|
129
138
|
|
|
130
139
|
## CLI
|
|
@@ -136,6 +145,9 @@ grindsharp worker --app jobs:jobs --db jobs.db --concurrency 4
|
|
|
136
145
|
# process one job then exit (useful for debugging)
|
|
137
146
|
grindsharp worker --app jobs:jobs --db jobs.db --once
|
|
138
147
|
|
|
148
|
+
# give the worker a stable name / tune stale-job recovery
|
|
149
|
+
grindsharp worker --app jobs:jobs --db jobs.db --worker-name worker-1 --stale-timeout-seconds 300
|
|
150
|
+
|
|
139
151
|
# inspect jobs
|
|
140
152
|
grindsharp --db jobs.db list --status pending --limit 20
|
|
141
153
|
grindsharp --db jobs.db stats
|
|
@@ -147,22 +159,7 @@ grindsharp --db jobs.db retry <job_id>
|
|
|
147
159
|
grindsharp --db jobs.db purge --status succeeded --older-than-seconds 86400
|
|
148
160
|
```
|
|
149
161
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
Use it when you want background jobs without extra infrastructure:
|
|
153
|
-
|
|
154
|
-
- small/medium web apps
|
|
155
|
-
- internal tools and SaaS MVPs
|
|
156
|
-
- single-server deployments
|
|
157
|
-
- low-to-moderate job volume
|
|
158
|
-
|
|
159
|
-
## When to use something else
|
|
160
|
-
|
|
161
|
-
- you need lots of workers spread across many machines
|
|
162
|
-
- you already run Redis/RabbitMQ and need the fancy queue features
|
|
163
|
-
- you need complex workflow/DAG orchestration
|
|
164
|
-
|
|
165
|
-
For many apps, a Postgres/Redis-backed queue is the next step up. Grindsharp is here to make the simple case easy.
|
|
162
|
+
When you run `grindsharp worker` from the CLI, it handles SIGINT/SIGTERM and stops gracefully.
|
|
166
163
|
|
|
167
164
|
## Postgres / Redis backends
|
|
168
165
|
|
|
@@ -180,11 +177,26 @@ jobs = Jobs(store=RedisJobStore(redis.Redis.from_url(REDIS_URL)))
|
|
|
180
177
|
|
|
181
178
|
These adapters keep the same `Jobs`/`Worker` API. Use SQLite for simple/local apps, Postgres for durable multi-worker SQL setups, and Redis for fast queue-style workloads.
|
|
182
179
|
|
|
180
|
+
## When to use Grindsharp
|
|
181
|
+
|
|
182
|
+
Good fit:
|
|
183
|
+
|
|
184
|
+
- small/medium web apps
|
|
185
|
+
- internal tools and SaaS MVPs
|
|
186
|
+
- single-server deployments
|
|
187
|
+
- low-to-moderate job volume
|
|
188
|
+
|
|
189
|
+
Not the right fit:
|
|
190
|
+
|
|
191
|
+
- lots of workers spread across many machines
|
|
192
|
+
- you already run Redis/RabbitMQ and need advanced queue features
|
|
193
|
+
- complex workflow/DAG orchestration
|
|
194
|
+
|
|
183
195
|
## Design notes
|
|
184
196
|
|
|
185
197
|
- Jobs are **at-least-once** (tasks should be idempotent).
|
|
186
198
|
- Payloads must be **JSON-serializable**.
|
|
187
|
-
- SQLite
|
|
199
|
+
- SQLite is great for small/medium single-node apps. When you need distributed throughput, move to a Postgres/Redis-style queue.
|
|
188
200
|
|
|
189
201
|
## Development
|
|
190
202
|
|
|
@@ -202,3 +214,7 @@ python scripts/integration_test_backends.py
|
|
|
202
214
|
```
|
|
203
215
|
|
|
204
216
|
This runs the same enqueue/retry/dead-job flow against real Postgres and Redis services.
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
MIT
|
|
@@ -1,183 +1,196 @@
|
|
|
1
|
-
# Grindsharp
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
The usual setup works, but it can be overkill for a small app
|
|
6
|
-
|
|
7
|
-
Grindsharp is for the common case: you just want background jobs that are reliable and easy to run.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
#
|
|
119
|
-
grindsharp --db jobs.db
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
1
|
+
# Grindsharp
|
|
2
|
+
|
|
3
|
+
SQLite-first background jobs for Python. No Redis required.
|
|
4
|
+
|
|
5
|
+
Most Python apps eventually need to do stuff in the background: send an email, process an upload, call a webhook, generate a report, retry something that flopped. The usual setup works, but it can be overkill for a small app - Redis, a broker, worker containers, extra config.
|
|
6
|
+
|
|
7
|
+
Grindsharp is for the common case: you just want background jobs that are reliable and easy to run.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Simple `@task` decorator
|
|
12
|
+
- `enqueue()`, `enqueue_in()`, `enqueue_at()`
|
|
13
|
+
- Retries with backoff
|
|
14
|
+
- Worker process with basic concurrency
|
|
15
|
+
- SQLite-backed job storage (WAL mode)
|
|
16
|
+
- Job status, crash recovery, and idempotent job IDs
|
|
17
|
+
- Small CLI for listing/retrying/stats
|
|
18
|
+
- Optional Postgres/Redis store adapters
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install grindsharp
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
For local development:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install -e .[dev]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
# jobs.py
|
|
36
|
+
from grindsharp import Jobs
|
|
37
|
+
|
|
38
|
+
jobs = Jobs("jobs.db")
|
|
39
|
+
|
|
40
|
+
@jobs.task(retries=3, retry_backoff_seconds=30, timeout_seconds=60)
|
|
41
|
+
def send_receipt_email(user_id: int, invoice_id: str) -> None:
|
|
42
|
+
print(f"send receipt to user={user_id} invoice={invoice_id}")
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Enqueue work from your app:
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from jobs import send_receipt_email
|
|
49
|
+
|
|
50
|
+
# run in the background
|
|
51
|
+
send_receipt_email.enqueue(user_id=42, invoice_id="inv_123")
|
|
52
|
+
|
|
53
|
+
# run later
|
|
54
|
+
send_receipt_email.enqueue_in(600, user_id=42, invoice_id="inv_123")
|
|
55
|
+
|
|
56
|
+
# avoid duplicates (idempotent job id)
|
|
57
|
+
send_receipt_email.enqueue(
|
|
58
|
+
user_id=42,
|
|
59
|
+
invoice_id="inv_123",
|
|
60
|
+
job_id="receipt:inv_123",
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
# if you want the existing job back instead of an error:
|
|
64
|
+
send_receipt_email.enqueue(
|
|
65
|
+
user_id=42,
|
|
66
|
+
invoice_id="inv_123",
|
|
67
|
+
job_id="receipt:inv_123",
|
|
68
|
+
if_exists="ignore",
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Run a worker:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
grindsharp worker --app jobs:jobs --db jobs.db
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
That's it: your web request returns quickly, and the worker handles the job.
|
|
79
|
+
|
|
80
|
+
## FastAPI example
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from fastapi import FastAPI
|
|
84
|
+
from grindsharp import Jobs
|
|
85
|
+
|
|
86
|
+
app = FastAPI()
|
|
87
|
+
jobs = Jobs("jobs.db")
|
|
88
|
+
|
|
89
|
+
@jobs.task(retries=3, retry_backoff_seconds=10)
|
|
90
|
+
def send_welcome_email(email: str) -> None:
|
|
91
|
+
...
|
|
92
|
+
|
|
93
|
+
@app.post("/signup")
|
|
94
|
+
def signup(email: str):
|
|
95
|
+
send_welcome_email.enqueue(email=email)
|
|
96
|
+
return {"ok": True}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Run the API and worker as separate processes:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
uvicorn app:app
|
|
103
|
+
grindsharp worker --app app:jobs --db jobs.db
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## How jobs behave
|
|
107
|
+
|
|
108
|
+
- **Durable:** jobs are saved in SQLite, so they survive app restarts.
|
|
109
|
+
- **At-least-once:** if a worker crashes mid-job, that job might run again. Write tasks so they're safe to retry.
|
|
110
|
+
- **Retries:** failed jobs retry with backoff (`retry_backoff_seconds * attempt`).
|
|
111
|
+
- **Timeouts:** if a task sets `timeout_seconds`, the worker marks it as timed out/failed when that limit passes (then it retries or goes dead like any other failure). A stuck Python thread may still keep running in-process, so task code should still respect timeouts/cancellation where it can.
|
|
112
|
+
- **Dead jobs:** when retries run out, the job gets marked `dead` and keeps the last error.
|
|
113
|
+
- **Crash recovery:** stale `running` jobs get moved back to `pending` after a timeout.
|
|
114
|
+
|
|
115
|
+
## CLI
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# run a worker
|
|
119
|
+
grindsharp worker --app jobs:jobs --db jobs.db --concurrency 4
|
|
120
|
+
|
|
121
|
+
# process one job then exit (useful for debugging)
|
|
122
|
+
grindsharp worker --app jobs:jobs --db jobs.db --once
|
|
123
|
+
|
|
124
|
+
# give the worker a stable name / tune stale-job recovery
|
|
125
|
+
grindsharp worker --app jobs:jobs --db jobs.db --worker-name worker-1 --stale-timeout-seconds 300
|
|
126
|
+
|
|
127
|
+
# inspect jobs
|
|
128
|
+
grindsharp --db jobs.db list --status pending --limit 20
|
|
129
|
+
grindsharp --db jobs.db stats
|
|
130
|
+
|
|
131
|
+
# retry a dead/failed job
|
|
132
|
+
grindsharp --db jobs.db retry <job_id>
|
|
133
|
+
|
|
134
|
+
# clean up old succeeded jobs
|
|
135
|
+
grindsharp --db jobs.db purge --status succeeded --older-than-seconds 86400
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
When you run `grindsharp worker` from the CLI, it handles SIGINT/SIGTERM and stops gracefully.
|
|
139
|
+
|
|
140
|
+
## Postgres / Redis backends
|
|
141
|
+
|
|
142
|
+
SQLite is the default. When you outgrow a single-node setup, Grindsharp can use a different store:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from grindsharp import Jobs, PostgresJobStore, RedisJobStore
|
|
146
|
+
|
|
147
|
+
# Postgres (pass a DBAPI connect callable, e.g. psycopg.connect)
|
|
148
|
+
jobs = Jobs(store=PostgresJobStore(connect=lambda: psycopg.connect(DB_URL)))
|
|
149
|
+
|
|
150
|
+
# Redis (pass a redis-py compatible client)
|
|
151
|
+
jobs = Jobs(store=RedisJobStore(redis.Redis.from_url(REDIS_URL)))
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
These adapters keep the same `Jobs`/`Worker` API. Use SQLite for simple/local apps, Postgres for durable multi-worker SQL setups, and Redis for fast queue-style workloads.
|
|
155
|
+
|
|
156
|
+
## When to use Grindsharp
|
|
157
|
+
|
|
158
|
+
Good fit:
|
|
159
|
+
|
|
160
|
+
- small/medium web apps
|
|
161
|
+
- internal tools and SaaS MVPs
|
|
162
|
+
- single-server deployments
|
|
163
|
+
- low-to-moderate job volume
|
|
164
|
+
|
|
165
|
+
Not the right fit:
|
|
166
|
+
|
|
167
|
+
- lots of workers spread across many machines
|
|
168
|
+
- you already run Redis/RabbitMQ and need advanced queue features
|
|
169
|
+
- complex workflow/DAG orchestration
|
|
170
|
+
|
|
171
|
+
## Design notes
|
|
172
|
+
|
|
173
|
+
- Jobs are **at-least-once** (tasks should be idempotent).
|
|
174
|
+
- Payloads must be **JSON-serializable**.
|
|
175
|
+
- SQLite is great for small/medium single-node apps. When you need distributed throughput, move to a Postgres/Redis-style queue.
|
|
176
|
+
|
|
177
|
+
## Development
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
pip install -e .[dev]
|
|
181
|
+
pytest
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Integration tests (real services):
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
docker compose -f docker-compose.integration.yml up -d
|
|
188
|
+
python -m pip install psycopg[binary] redis
|
|
189
|
+
python scripts/integration_test_backends.py
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
This runs the same enqueue/retry/dead-job flow against real Postgres and Redis services.
|
|
193
|
+
|
|
194
|
+
## License
|
|
195
|
+
|
|
196
|
+
MIT
|
|
@@ -1,45 +1,50 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=61.0"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "grindsharp"
|
|
7
|
-
version = "0.1.
|
|
8
|
-
description = "SQLite-first background jobs for Python. No Redis required."
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.9"
|
|
11
|
-
license = { text = "MIT" }
|
|
12
|
-
authors = [{ name = "
|
|
13
|
-
dependencies = []
|
|
14
|
-
keywords = ["background-jobs", "queue", "sqlite", "worker", "tasks", "scheduler"]
|
|
15
|
-
classifiers = [
|
|
16
|
-
"Development Status ::
|
|
17
|
-
"Intended Audience :: Developers",
|
|
18
|
-
"License :: OSI Approved :: MIT License",
|
|
19
|
-
"Programming Language :: Python :: 3",
|
|
20
|
-
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
-
"Topic :: Software Development :: Libraries",
|
|
22
|
-
"Typing :: Typed",
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
[project.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
[
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
[
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "grindsharp"
|
|
7
|
+
version = "0.1.2"
|
|
8
|
+
description = "SQLite-first background jobs for Python. No Redis required."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "GT47THY" }]
|
|
13
|
+
dependencies = []
|
|
14
|
+
keywords = ["background-jobs", "queue", "sqlite", "worker", "tasks", "scheduler"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Topic :: Software Development :: Libraries",
|
|
22
|
+
"Typing :: Typed",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://pypi.org/project/grindsharp/"
|
|
27
|
+
Repository = "https://pypi.org/project/grindsharp/"
|
|
28
|
+
Issues = "https://pypi.org/project/grindsharp/"
|
|
29
|
+
|
|
30
|
+
[project.optional-dependencies]
|
|
31
|
+
dev = ["pytest>=7.4"]
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
grindsharp = "grindsharp.cli:main"
|
|
35
|
+
|
|
36
|
+
[tool.setuptools]
|
|
37
|
+
package-dir = {"" = "src"}
|
|
38
|
+
include-package-data = true
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.packages.find]
|
|
41
|
+
where = ["src"]
|
|
42
|
+
include = ["grindsharp*"]
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.package-data]
|
|
45
|
+
grindsharp = ["py.typed"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
|
49
|
+
pythonpath = ["src"]
|
|
50
|
+
addopts = "-ra --strict-markers"
|