Modular, benchmarkable pipeline framework
Project description
Pipetree gives you capability-based contracts, streaming execution, async support, checkpointing, pluggable implementations via a registry, and built-in A/B benchmarking — all wired together with a clean DSL.
Monitor your pipelines and benchmark results in real-time at pipetree.io.
Quick Start
cd pipetree
pipenv install --dev
pipenv run pip install -e .
import asyncio
from pipetree import step, pipeline, Step, Context
@step(requires={"input"}, provides={"words"})
class Split(Step):
def run(self, ctx: Context) -> Context:
ctx["words"] = ctx["input"].split()
return ctx
@step(requires={"words"}, provides={"output"})
class Shout(Step):
def run(self, ctx: Context) -> Context:
ctx["output"] = "_".join(w.upper() for w in ctx["words"])
return ctx
result = asyncio.run(pipeline("demo", [Split, Shout]).run({"input": "hello world"}))
# result["output"] == "HELLO_WORLD"
Benchmarking
Register multiple implementations of the same capability, then A/B test them:
from pipetree import step, Step, Context, Capability, Registry, BenchRunner
@step(requires={"items"}, provides={"sorted"})
class BubbleSort(Step):
def run(self, ctx: Context) -> Context:
arr = list(ctx["items"])
for i in range(len(arr)):
for j in range(len(arr) - i - 1):
if arr[j] > arr[j + 1]:
arr[j], arr[j + 1] = arr[j + 1], arr[j]
ctx["sorted"] = arr
return ctx
@step(requires={"items"}, provides={"sorted"})
class BuiltinSort(Step):
def run(self, ctx: Context) -> Context:
ctx["sorted"] = sorted(ctx["items"])
return ctx
# Register both under the same capability
sorting = Capability(name="sorting", requires={"items"}, provides={"sorted"})
registry = Registry()
registry.register("sorting", "bubble", lambda: BubbleSort(sorting, "bubble"))
registry.register("sorting", "builtin", lambda: BuiltinSort(sorting, "builtin"))
# Run the benchmark
runner = BenchRunner(registry=registry)
results = runner.run_step_ab(
cap_name="sorting",
impls=["bubble", "builtin"],
fixtures=[
{"id": "small", "items": list(range(100, 0, -1))},
{"id": "large", "items": list(range(10000, 0, -1))},
],
judge=lambda fixture, ctx: {"correctness": float(ctx["sorted"] == sorted(fixture["items"]))},
setup_ctx=lambda fixture: {"items": fixture["items"]},
)
Cloud
Send pipeline progress and benchmark results to pipetree.io by setting two env vars:
export PIPETREE_HOST=https://pipetree.io
export PIPETREE_API_KEY=your-api-key
from pipetree import HTTPProgressNotifier, HTTPBenchmarkStore, BenchRunner, pipeline
# Progress tracking
notifier = HTTPProgressNotifier(base_url=..., api_key=..., pipeline="my-pipeline")
my_pipeline = pipeline("my-pipeline", [Split, Shout], progress_notifier=notifier)
# Remote benchmark results
store = HTTPBenchmarkStore(base_url=..., api_key=...)
runner = BenchRunner(registry=my_registry, store=store)
Development
cd pipetree
bin/check # lint, types, tests (100% coverage)
License
O'Saasy License - Free to use, modify, and self-host. SaaS rights reserved.
Project details
Release history Release notifications | RSS feed
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 pipetree_io-0.1.2.tar.gz.
File metadata
- Download URL: pipetree_io-0.1.2.tar.gz
- Upload date:
- Size: 61.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0213c245194a90a0fee67dcace589250d4d849cdfe9ac4fef69a1ac691b543d
|
|
| MD5 |
3fbc01adc1233639fbc688dcdbc1fdf6
|
|
| BLAKE2b-256 |
e69e6aeaa4be024bef8145f04d5be5da894119310ebdb9e0253d441773683eaa
|
Provenance
The following attestation bundles were made for pipetree_io-0.1.2.tar.gz:
Publisher:
publish.yml on silver-river-us/pipetree
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pipetree_io-0.1.2.tar.gz -
Subject digest:
f0213c245194a90a0fee67dcace589250d4d849cdfe9ac4fef69a1ac691b543d - Sigstore transparency entry: 927174383
- Sigstore integration time:
-
Permalink:
silver-river-us/pipetree@13d7f166dc8a71b87f0a63ce4949b4b50cfa3d8b -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/silver-river-us
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@13d7f166dc8a71b87f0a63ce4949b4b50cfa3d8b -
Trigger Event:
push
-
Statement type:
File details
Details for the file pipetree_io-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pipetree_io-0.1.2-py3-none-any.whl
- Upload date:
- Size: 90.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a5041570e1f9f7bdb47201a77d8ad3fac2ef14c5132add5b8e1f7fe6c35ebd7
|
|
| MD5 |
fc06abd04b04c72750e041c7a47eefd4
|
|
| BLAKE2b-256 |
4a611ed281ba1544acb5217990e14dbd9500a275cf34b3eda9f909bea43f6398
|
Provenance
The following attestation bundles were made for pipetree_io-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on silver-river-us/pipetree
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pipetree_io-0.1.2-py3-none-any.whl -
Subject digest:
4a5041570e1f9f7bdb47201a77d8ad3fac2ef14c5132add5b8e1f7fe6c35ebd7 - Sigstore transparency entry: 927174384
- Sigstore integration time:
-
Permalink:
silver-river-us/pipetree@13d7f166dc8a71b87f0a63ce4949b4b50cfa3d8b -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/silver-river-us
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@13d7f166dc8a71b87f0a63ce4949b4b50cfa3d8b -
Trigger Event:
push
-
Statement type: