Skip to main content

larzpipe

Lazy, composable data pipelines. Pure Python, zero dependencies.

Instead of nesting map(filter(...)) inside out, or building intermediate lists, chain the operations left-to-right and evaluate lazily. Nothing runs until you ask for a result, so infinite and huge sources are fine.

from larzpipe import pipe

(pipe(range(1_000_000))
    .filter(lambda x: x % 2 == 0)
    .map(lambda x: x * x)
    .take(5)
    .to_list())                 # [0, 4, 16, 36, 64]

pipe(words).map(str.lower).distinct().group_by(len)

Why

  • Reads top-to-bottom. The order you write is the order data flows - no more reading map(filter(map(...))) from the inside out.
  • Lazy. Everything is generator-based; take(5) off an infinite source does five items of work. Re-iterable when the source is (lists, ranges).
  • Batteries. map filter flat_map take/skip take_while/drop_while distinct(key) batch window enumerate tap sort zip chain, plus terminals to_list/to_dict/reduce/group_by/count/first/sum/min/ max/any/all.
  • Zero dependencies. Just a friendly face over itertools.

Install

pip install larzpipe

Usage

from larzpipe import pipe

pipe(data).filter(pred).map(fn).batch(100).for_each(save)
pipe(logs).map(parse).distinct(key=lambda e: e.id).group_by(lambda e: e.level)
pipe(nums).take_while(lambda x: x < 100).reduce(lambda a, b: a + b)

Tests

python -m unittest discover -s tests -v   # 20 tests incl. laziness + re-iterability

The Larz stack

One of 30+ pure-Python, zero-dependency libraries at github.com/larz-scripter.

License

MIT (c) larz-scripter

Metadata

Release files for larzpipe 0.1.0

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

Source distribution (sdist)

Source distribution for larzpipe 0.1.0
File Size Uploaded Provenance
larzpipe-0.1.0.tar.gz 5.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for larzpipe 0.1.0
File Interpreter ABI Platform
larzpipe-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / larzpipe-0.1.0.tar.gz

Download URL larzpipe-0.1.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
05246508d6e87e5903ed5ac202c7b608bffbf9167c27f9f35cdd5e44d1380167
BLAKE2b-256 checksum
How to use checksums
22bc1996e6b99c7e734cd601e1d984fe64147a5c37ee0eebb78e21f946ca7a99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / larzpipe-0.1.0-py3-none-any.whl

Download URL larzpipe-0.1.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
691fe1b5efd122100992c6c1eba555dff1ecd9649ef17321568ec34977276f0f
BLAKE2b-256 checksum
How to use checksums
30bbfbf02ca1012bacd0f20685791f66e260dbb5ad866ba909cbea30a28323f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for larzpipe 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

0.1.0 This release

2 release files No provenance

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