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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lightpipeline-0.2.0.tar.gz.
File metadata
- Download URL: lightpipeline-0.2.0.tar.gz
- Upload date:
- Size: 129.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63e2b0c2e3fcd3446ceb68a33c7046a78e55afe9fce00711327a637088688b96
|
|
| MD5 |
ce46b0e2b97c46ea80bea1a324702807
|
|
| BLAKE2b-256 |
13714b648e11352fce4bbb81bb4ceb4dfb3ddb63a396b753317172a719a46fb8
|
Provenance
The following attestation bundles were made for lightpipeline-0.2.0.tar.gz:
Publisher:
release.yml on dmoggles/lightpipe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lightpipeline-0.2.0.tar.gz -
Subject digest:
63e2b0c2e3fcd3446ceb68a33c7046a78e55afe9fce00711327a637088688b96 - Sigstore transparency entry: 2731295810
- Sigstore integration time:
-
Permalink:
dmoggles/lightpipe@f04667a78795a2d747c93a94241a9c184c1a2f7e -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/dmoggles
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f04667a78795a2d747c93a94241a9c184c1a2f7e -
Trigger Event:
release
-
Statement type:
File details
Details for the file lightpipeline-0.2.0-py3-none-any.whl.
File metadata
- Download URL: lightpipeline-0.2.0-py3-none-any.whl
- Upload date:
- Size: 142.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fac4c57988e0326791ed717a0237f40298f8b8be88e987d3f47f70393ab7556
|
|
| MD5 |
14abb88453592b3c42fc00bac2649363
|
|
| BLAKE2b-256 |
61c34f0787a54f1874ff5581fa82b1bb16ea1c31d78bb5d59820b2a23110e209
|
Provenance
The following attestation bundles were made for lightpipeline-0.2.0-py3-none-any.whl:
Publisher:
release.yml on dmoggles/lightpipe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lightpipeline-0.2.0-py3-none-any.whl -
Subject digest:
6fac4c57988e0326791ed717a0237f40298f8b8be88e987d3f47f70393ab7556 - Sigstore transparency entry: 2731295885
- Sigstore integration time:
-
Permalink:
dmoggles/lightpipe@f04667a78795a2d747c93a94241a9c184c1a2f7e -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/dmoggles
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f04667a78795a2d747c93a94241a9c184c1a2f7e -
Trigger Event:
release
-
Statement type: