lightpipe
lightpipe is a small Python pipeline orchestrator built around ordinary decorated functions,
dynamic fan-out, durable at-least-once work delivery, and replaceable storage backends.
See Project state and roadmap for the current maturity of each subsystem, known gaps, and the recommended implementation sequence.
For an operational walkthrough, see Deploying pipelines with workers. For operator APIs, recovery semantics, and telemetry, see Monitoring and recovery controls. For retention, resource policies, backfills, and worker draining, see Storage and execution hardening.
The project currently includes:
- a typed
@stage/@pipelinegraph DSL; - declarative
mapandcollectoperations; - a backend-neutral orchestration contract and in-memory implementation;
- a Postgres adapter with task leases, fencing, retries, and append-only events;
- versioned Alembic migrations and a reproducible split-process Compose deployment;
- opt-in, TTL-bound result caching;
- filesystem and S3-compatible artifact stores;
- long-lived workers with supervised task subprocesses;
- schedule and stateful-poller definitions;
- timezone-aware cron schedules, signed webhooks, and managed trigger history;
- a CLI and a runnable FastAPI monitoring/control service.
- a bundled React operations dashboard with DAG, attempt, log, artifact, and recovery views;
- optional OpenTelemetry traces, metrics, and correlated logs.
Development
Python environments and project commands are managed with Astral's uv. The lockfile is created
the first time dependencies are resolved.
uv sync --all-groups --all-extras
uv run ruff check .
uv run ruff format --check .
uv run ty check
uv run pytest
uv build
Ruff owns formatting, import sorting, and linting. ty is the type checker and language server.
Installation
Installing the wheel creates a lightpipe executable in the active Python environment. Keep the
installation minimal or select only the integrations the deployment needs:
pip install lightpipe
pip install "lightpipe[api]"
pip install "lightpipe[postgres]"
pip install "lightpipe[api,postgres]"
The base package contains the DSL, runtime, in-memory backend, and CLI. api installs FastAPI and
Uvicorn; postgres installs psycopg and Alembic. After installation, production commands run
directly—uv is not required:
lightpipe --help
python -m lightpipe --help
Defining a pipeline
from datetime import timedelta
from lightpipe import CachePolicy, pipeline, stage
@stage
def scrape(target: str) -> list[dict[str, object]]: ...
@stage(cache=CachePolicy(timedelta(hours=4)), retries=2)
def predict(row: dict[str, object]) -> dict[str, object]: ...
@stage
def save(row: dict[str, object]) -> None: ...
@pipeline
def ingest(target: str):
predictions = predict.map(scrape(target))
return save.map(predictions) # A terminal map needs no collect operation.
Calls inside a pipeline definition build a graph. Stage functions do not execute until a worker
claims the corresponding task. A mapped result can instead be passed to an aggregate stage using
predictions.collect().
Run it locally:
uv run lightpipe run examples.scrape_and_predict:scrape_and_predict \
--parameters '{"target":"example"}'
Launching the service and UI
Start the API, dashboard, reconciler, trigger scheduler, and one local worker with:
uv run lightpipe serve examples.scrape_and_predict:scrape_and_predict
Open http://127.0.0.1:8000 to submit and inspect runs. The service also exposes liveness at
/health/live, readiness at /health/ready, and worker/trigger status at /api/workers. Stop it
with Ctrl-C; active tasks are allowed a grace period and then safely released for another worker.
Pass additional module:object arguments to register pollers or schedules alongside pipelines.
Webhook definitions are accepted as well. For production, pass --no-scheduler to serve and
run independently scalable scheduler replicas:
uv run lightpipe --backend "$DATABASE_URL" scheduler \
my_project:pipeline my_project:daily_schedule my_project:incoming_webhook
See Trigger automation for cron/DST behavior, overlap and missed-run
policies, webhook signing, pause/resume controls, recovery semantics, and a runnable example.
Use --workers N for a larger local worker pool and --no-process-isolation when debugging stage
functions in the server process. Run uv run lightpipe serve --help for all options.
The versioned /api/v1 endpoints provide cursor-paginated run and definition queries, task-attempt
history, resumable event and log streams, cancellation, linked reruns, and in-place failed-task
retry. Existing /api endpoints remain available for compatibility.
The dashboard source is in dashboard/; its compiled assets are included in the Python wheel.
Rebuild them after frontend changes:
cd dashboard
npm ci
npm run build
OpenTelemetry export is disabled unless LIGHTPIPE_OTEL_ENABLED=true or an
OTEL_EXPORTER_OTLP_ENDPOINT is configured. Install opentelemetry-sdk and
opentelemetry-exporter-otlp in deployments that enable export.
Backends
OrchestrationBackend is a semantic boundary rather than a database CRUD interface. Adapters own
atomic run/task transitions, leases, fencing, event persistence, trigger ownership, and cache races.
Pipeline code sees none of those implementation details.
The in-memory backend provides matching execution behavior for tests and local development, without restart durability. Postgres is the first durable adapter:
Initialize or upgrade its schema explicitly before starting services:
lightpipe --backend postgresql://user:password@localhost/lightpipe db status
lightpipe --backend postgresql://user:password@localhost/lightpipe db upgrade
from lightpipe.backends.postgres import PostgresBackend
backend = PostgresBackend("postgresql://user:password@localhost/lightpipe")
await backend.initialize()
initialize() opens the pool and verifies that the schema is current; it never applies migrations.
Workers are started with all pipeline definitions they are allowed to execute:
lightpipe --backend postgresql://user:password@localhost/lightpipe worker \
examples.scrape_and_predict:scrape_and_predict
For a durable split-process demo, run docker compose up --build, then open
http://127.0.0.1:8000. This starts PostgreSQL 16, runs migrations once, launches a control-only
API, and launches a separate worker. Use docker compose down to stop it; add --volumes only
when you intentionally want to delete its database.
Postgres notifications are only wake-up hints. Runnable task rows remain authoritative, so lost
notifications cannot lose work. Task outputs must be JSON-compatible; larger data should be placed
in an ArtifactStore and represented by an ArtifactRef.
Third-party adapters are exposed through the lightpipe.backends entry-point group. A conforming
adapter must pass the behavioral suite represented by tests/test_backend_contract.py.
Delivery guarantees
Workers claim tasks with expiring leases and fencing tokens. A crashed worker's task becomes runnable again. A stale worker cannot commit after another worker acquires the task. Therefore stage execution is at least once: external side effects must use the stable run/task identity or their own transactional idempotency key.
Caching is deliberately opt-in because cached stages are expected to be pure. Cache expiration controls reuse; artifact retention is a separate concern.
Current boundaries
This initial implementation targets a single trusted operator. It does not provide multi-tenancy, RBAC, cyclic graphs, arbitrary topology mutation from stage code, or continuous record streaming. Artifact garbage collection is opt-in and requires a configured shared store. Interval schedules and stateful pollers keep their ownership and cursor state in the selected orchestration backend.
Metadata
Release files for lightpipeline 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lightpipeline-0.2.0.tar.gz | 129.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lightpipeline-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 271.6 kB
Release files / lightpipeline-0.2.0.tar.gz
| Download URL | lightpipeline-0.2.0.tar.gz |
|---|---|
| Size | 129.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63e2b0c2e3fcd3446ceb68a33c7046a78e55afe9fce00711327a637088688b96
|
|
BLAKE2b-256 checksum How to use checksums |
13714b648e11352fce4bbb81bb4ceb4dfb3ddb63a396b753317172a719a46fb8
|
| 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 Sep 5, 2026.
Transparency logRelease files / lightpipeline-0.2.0-py3-none-any.whl
| Download URL | lightpipeline-0.2.0-py3-none-any.whl |
|---|---|
| Size | 142.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6fac4c57988e0326791ed717a0237f40298f8b8be88e987d3f47f70393ab7556
|
|
BLAKE2b-256 checksum How to use checksums |
61c34f0787a54f1874ff5581fa82b1bb16ea1c31d78bb5d59820b2a23110e209
|
| 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 Sep 5, 2026.
Transparency logSecurity for lightpipeline 0.2.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for lightpipeline-0.2.0.tar.gz
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 Sep 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.