Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

staged-pipeline

Статус: pre-release (0.1.0a). API описан в docs/architecture.md, реализация — по docs/plan/PLAN.md. До релиза 0.1.0 возможны изменения.

Декларативный конвейер стадий поверх asyncio внутри одного процесса: пул воркеров на стадию, дедупликация, ретраи с backoff, предохранители, лимиты и живой прогресс. Режим завершения выводится из графа (DAG закрывается по писателям, цикл — по quiescence), поэтому «выбрать неправильный режим и повиснуть» нельзя.

Чем это является

  • слой внутри одного процесса и одного event loop: стадии с воркерами, маршрутизацией по типу, политиками исходов (retry/skip_on/error_on), лимитами и дедупликацией;
  • источник честного прогресса: found / queued / in_flight / deferred / ok / skip / error / cancelled / duplicates, expected и eta;
  • одноразовый граф, проверяемый до старта (ошибка топологии не запускает ничего).

Чем это не является

  • не durable и не распределённая система — всё в одном процессе;
  • не владеет хранилищем: устойчивость между прогонами даёт БД домена (resume засевом);
  • не замена очереди задач (Tallyho и подобных) — это слой внутри одного Item.

Установка

uv add staged-pipeline            # ядро, без зависимостей
uv add "staged-pipeline[tallyho]" # + маркер интеграции с Tallyho

Требуется Python 3.13+.

Quickstart

import asyncio
from staged_pipeline import Pipeline


async def scan(folder: str):          # async-генератор: потоковый fan-out
    for i in range(3):
        yield f"{folder}/{i}"


async def resolve(path: str) -> list[str]:   # атомарный fan-out
    return [f"{path}.a", f"{path}.b"]


async def download(url: str) -> None:        # терминальная стадия
    ...


async def main() -> None:
    pipe = Pipeline("export")
    listing = pipe.stage("list", scan, workers=2)
    resolving = pipe.stage("resolve", resolve, workers=8, key=lambda p: p)
    media = pipe.stage("media", download, workers=4, key=lambda u: u)

    listing.to(resolving)
    resolving.to(media)
    listing.seed(["inbox"])

    report = await pipe.run()
    print(report.stages["media"].ok)


asyncio.run(main())

Больше примеров — в examples/: crawler.py (цикл/самопетля) и export.py (fan-out + dedup + resume). Оба исполняются в тестах.

Когда этапы Tallyho, а когда пайплайн

Критерий Этапы Tallyho (sub_batch + fed_by) Пайплайн внутри Item
Элемент должен пережить падение воркера сам по себе ✔ ✘ (resume — через БД домена)
Элементы дешёвые (≪ 100 мс) и их 10⁴–10⁶ на единицу дорого: строка + коммит на элемент ✔
Общая сессия/лиз/соединение на единицу ✘ (лиз на задачу) ✔
Масштаб на несколько машин ✔ ✘
Нужен точный итог по каждому элементу в БД ✔ домен пишет сам

Мост прогресса и остановки к Tallyho — staged_pipeline.integrations.tallyho (track, outcome_for), без зависимости от tallyho. Подробности — architecture.md §9.

Документация

Лицензия

MIT.

Metadata

Release files for staged-pipeline 0.1.0a1

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

Source distribution (sdist)

Source distribution for staged-pipeline 0.1.0a1
File Size Uploaded Provenance Actions
staged_pipeline-0.1.0a1.tar.gz 165.0 kB With provenance Details for staged_pipeline-0.1.0a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for staged-pipeline 0.1.0a1
File Interpreter ABI Platform Actions
staged_pipeline-0.1.0a1-py3-none-any.whl Python 3 none any Details for staged_pipeline-0.1.0a1-py3-none-any.whl

Total release size: 213.9 kB

Release files / staged_pipeline-0.1.0a1.tar.gz

Download URL staged_pipeline-0.1.0a1.tar.gz
Size 165.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cd41e6c340cab86cd2bf9aff9745926d892c4eeadd4ab11de83b377d37656529
BLAKE2b-256 checksum
How to use checksums
4d546be8730b72cb7a3d74dc5dac5cd8b084a9cf7dd7601e8ad434db715b6211
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 25, 2026.

Transparency log

Release files / staged_pipeline-0.1.0a1-py3-none-any.whl

Download URL staged_pipeline-0.1.0a1-py3-none-any.whl
Size 48.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc66bb97bfb3c996388f42ddcb6ec9fa2607f56281936d734439e5038476be6d
BLAKE2b-256 checksum
How to use checksums
8ebafab5ceef1743e0120634d20b260dabe487fd199cff4d29b6a92ca0f5ccff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 25, 2026.

Transparency log

Security for staged-pipeline 0.1.0a1

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for staged_pipeline-0.1.0a1.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 Oct 25, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release
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