Embedded async pipeline engine for FastAPI
Project description
Pipely
Pipely is a small embedded async pipeline engine for FastAPI services. It is for long in-process workflows such as OCR, document processing, meeting protocol generation, indexing, LLM agents, and report generation where Airflow or Prefect would be too heavy.
MVP scope:
- linear async pipelines;
- Postgres persistence through SQLAlchemy 2 async;
- automatic table creation;
- in-process execution;
- retries, resume, retry failed, restart from step, cancel;
- FastAPI REST API and a small built-in HTML UI.
Install
pip install -e ".[test]"
For production use, provide a Postgres URL:
postgresql+asyncpg://user:password@host:5432/database
Usage
from fastapi import FastAPI
from pipely import PipelineContext, Pipely, step
app = FastAPI()
pipely = Pipely(database_url=settings.DATABASE_URL, ui_path="/_pipely")
pipely.mount(app)
@pipely.pipeline("meeting_protocol")
class MeetingProtocolPipeline:
@step(retries=3)
async def transcribe(self, ctx: PipelineContext) -> None:
transcript = await transcribe_audio(ctx.input["audio_url"])
ctx.set("transcript", transcript)
@step(retries=2)
async def clean_transcript(self, ctx: PipelineContext) -> None:
clean = await clean_text(ctx.get("transcript"))
ctx.set("clean_transcript", clean)
@step(retries=2)
async def extract_tasks(self, ctx: PipelineContext) -> None:
tasks = await extract_tasks(ctx.get("clean_transcript"))
ctx.set("tasks", tasks)
Start and control runs:
run = await pipely.start("meeting_protocol", input={"audio_url": "s3://bucket/audio.mp3"})
await pipely.retry_failed(run.id)
await pipely.resume(run.id)
await pipely.restart_from_step(run.id, "extract_tasks")
await pipely.cancel(run.id)
Mounted endpoints:
GET /_pipelyGET /_pipely/api/runsGET /_pipely/api/runs/{run_id}POST /_pipely/api/runsPOST /_pipely/api/runs/{run_id}/retryPOST /_pipely/api/runs/{run_id}/resumePOST /_pipely/api/runs/{run_id}/restart-from-stepPOST /_pipely/api/runs/{run_id}/cancel
Architecture
Pipelyregisters pipelines and mounts FastAPI routes.PipelineContextexposesinput, persistentstate,get,set,flush, andlog.Storageowns SQLAlchemy async persistence and creates tables from metadata.InProcessExecutorexecutes steps sequentially, skips successful steps on resume, records attempts/errors/tracebacks, and marks stale running steps failed before resume.ui.pyserves a dependency-free HTML/JS developer UI.
Next Steps
- background execution mode for REST starts;
- real migration integration with Alembic;
- graph transitions after the linear MVP stabilizes;
- cron/queue/distributed workers;
- richer metrics export.
Project details
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 pipely_core-0.1.0.tar.gz.
File metadata
- Download URL: pipely_core-0.1.0.tar.gz
- Upload date:
- Size: 6.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03752d9532bca3f9d86b50199b604aaaed8ba659427b6facf5f2148d00213c45
|
|
| MD5 |
64a1b466f9bbe180d74f85ce6be8eac6
|
|
| BLAKE2b-256 |
2ba56905d7ad12dc2f7e7c10880116a4b16932f4189a89dee1cbc35b98bec200
|
File details
Details for the file pipely_core-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pipely_core-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c20d7af58bf42eb79977bcbb016ab59d6a17d56025a265e3d2ec07f195db67e
|
|
| MD5 |
d2aa89dd524e53792eb490712644c800
|
|
| BLAKE2b-256 |
984aec121e86d493feb6ab51fb8bbc8f4d974558b5b3b6108e68faccd59bc125
|