Skip to main content

smallage — wild celery (Apium graveolens)

smallage

PyPI version Python versions License CI Checked with mypy

Background tasks, cron and a dead letter queue on Redis Streams — typed tasks, retries with backoff, delayed jobs, and consumption of streams somebody else writes. The core reaches for no web framework; the Litestar layer adds real dependency injection and a CLI through the native plugin protocol.

Smallage is the old name for wild celery.

📖 Documentation

Features

  • Tasks are ordinary functions: arguments are serialised, dependencies injected
  • Retries with backoff, a delivery ceiling, and a dead letter queue that keeps the payload, the traceback and the attempt history
  • Delayed jobs and cron with no scheduler process, correct across DST
  • Priority queues with a bounded starvation window, and shards for fairness
  • Broker mode: consume streams somebody else writes, in the same worker
  • Optional results, a deduplication gate, and trace context carried into the task
  • Health endpoint served identically by the web process and the worker
  • Eager mode, assert_enqueued and a real-worker fixture for your own tests

Installation

uv add smallage

Redis 7 or newer. Standalone, Sentinel and Cluster are all covered by the test suite.

Quick start

from dataclasses import dataclass
from uuid import UUID, uuid4

from litestar import Litestar, post
from litestar.di import Provide

from smallage.litestar import QueueConfig, QueuePlugin, TaskRegistry

tasks = TaskRegistry()


@dataclass
class Settings:
    index_name: str = "documents"


def settings() -> Settings:
    return Settings()


@tasks.task
async def reindex(doc_id: UUID, settings: Settings) -> None:
    """`doc_id` is serialised; `settings` comes from the application."""


@post("/documents")
async def create() -> str:
    await reindex.enqueue(doc_id=uuid4())
    return "queued"


app = Litestar(
    route_handlers=[create],
    dependencies={"settings": Provide(settings, sync_to_thread=False)},
    plugins=[QueuePlugin(QueueConfig(registry=tasks, redis_url="redis://localhost"))],
)

doc_id travels in the payload; settings is injected in the worker from the application's own dependency graph, and a real one would be a database session or a client. There is no context dictionary.

Workers

A worker is the same application, started differently:

litestar workers run --queue high --concurrency 20

The lifecycle comes with it: a worker enters the application's lifespan, so on_startup hooks and lifespan managers run there too and a dependency closing over what they opened is usable in a task. run_app_lifespan=False declines that, for a lifespan whose work belongs to a web process alone.

Anything that can be settled at startup is — a task registered twice, an argument with no annotation, a dependency the application does not provide, a cycle, a provider only a request could satisfy — rather than on the first job in production.

Delivery guarantee

At-least-once. A worker that completed its side effect and died before XACK will be reclaimed and the work repeated. No amount of protocol work removes that; only an idempotent handler does. A dedup key is provided for the cases where that is not naturally true.

Documentation

Tasks, scheduling, retries, priorities, broker mode, results, testing and operations are covered in the full documentation. The rules the library is built to are in Design and invariants. Runnable examples are included.

Development

make install   # dependencies and git hooks
make check     # lint, types, import contracts, unit tests
make test-int  # integration suite, needs Docker

License

MIT

Metadata

Release files for smallage 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smallage 0.2.0
File Size Uploaded
smallage-0.2.0.tar.gz 240.9 kB Details

Built distribution (wheel)

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

Total release size: 292.3 kB

Release files / smallage-0.2.0.tar.gz

Download URL smallage-0.2.0.tar.gz
Size 240.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8085415ee72603e75288d62961239acc788e00e29cde7b592cf7b0afa65a55f4
BLAKE2b-256 checksum
How to use checksums
723a940c94be5774757a5613481509e0e627d8c12598b9027d4e36adb7d0b16b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 31, 2026.

Transparency log

Release files / smallage-0.2.0-py3-none-any.whl

Download URL smallage-0.2.0-py3-none-any.whl
Size 51.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60df7bcfca9c7be5e28f0b0c8815eb34099e51d1ffccc2d57d47aa875d584c5a
BLAKE2b-256 checksum
How to use checksums
2cae4a2ab7088145ff25aac2bc32c7596affbd56c12341ddc1d76bc9eee80df6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 31, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

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