From 7bfc742f68061ddfde308336a1d4d47c52da1913 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Fri, 21 Mar 2025 22:20:57 +0100 Subject: Update description --- README.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 33b51b2..09eda95 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,22 @@ # Rivulet -Elegant asynchronous data streams +Lightweight asynchronous data streams ```python -from rivulet import BatchProcessor - -async def item_stream(): - for i in range(10): - yield i - await asyncio.sleep(0.1) +from rivulet import Pipeline, Batch async def main(): - processor = BatchProcessor(batch_size=3, timeout_seconds=0.5) - - async for batch in processor.process(item_stream()): - print(f"Processing batch of {len(batch)} items: {batch}") + pipe = Pipeline(source()) + pipe.add_step(double) + + batch = Batch(N=5, timeout=0.1) + pipe.add_step(batch) + pipe.add_step(sum) + + # run the pipeline + async for out in pipe: + print(out) + + # or collect them all + res = await pipe.collect() ``` \ No newline at end of file -- cgit v1.3.1