summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2025-03-21 22:20:57 +0100
committerYuval Adam <_@yuv.al>2025-03-21 22:21:56 +0100
commit7bfc742f68061ddfde308336a1d4d47c52da1913 (patch)
tree08d1badb4e09d761422260f2b20847ca422df93b /README.md
parent9b56aaa7a1aefc2fd07e3bf4baedf9206d9dd7ad (diff)
Update description
Diffstat (limited to 'README.md')
-rw-r--r--README.md26
1 files changed, 15 insertions, 11 deletions
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