Skip to content

pyochain ⛓️

Functional-style method chaining for Python data structures.

Welcome to the pyochain documentation! This library brings a fluent, declarative API inspired by Rust and DataFrame libraries to your Python iterables and dictionaries.

Installation

uv add pyochain

Quick start

from pyochain import Iter, Seq

res = (
    Iter
    .from_count(1)
    .filter(lambda x: x % 2 != 0)
    .map(lambda x: x**2)
    .take(5)
    .collect(Seq)
)
assert res == (1, 9, 25, 49, 81)

Next steps