Everyday Utilities

toolz

Brings the elegant, assembly-line style of functional programming to everyday Python code.

Install it: pip install toolz

What does it do?

Toolz gives Python a set of small, composable building blocks, functions for filtering, transforming, grouping, and combining data, designed in the functional programming style, where you build a pipeline out of tiny reusable pieces rather than one big procedural block. Imagine an assembly line where each station does exactly one simple job and you can rearrange the stations freely; that’s the mental model toolz encourages. It deliberately keeps individual functions small, fast, and pure, meaning they don’t sneakily change data behind your back. It draws heavy inspiration from functional languages, bringing some of their elegance into a language not built around that style by default.

See it in action

This passes the number 5 through a small assembly line of steps, first adding one and then doubling it, printing the final result of 12.

from toolz import pipe

result = pipe(5, lambda x: x + 1, lambda x: x * 2)
print(result)

Why would a non-developer care?

Code written in small, predictable, reusable pieces tends to have fewer bugs and is easier for other people to read and trust, which matters a great deal in software handling anything important, like financial or scientific calculations. Toolz reflects a broader philosophy that heavily influences how experienced Python data engineers structure their code, even for people who never import it directly.

Real-world examples

It’s popular in data engineering and scientific computing circles, and it directly inspired other tools; Dask, widely used for parallel and large-scale data processing, deliberately builds on the same functional design ideas. Anyone who’s admired unusually clean, pipeline-style Python code in a data project has likely seen this philosophy in action.

Who uses it

Data engineers and Python developers who prefer building data pipelines out of small, composable functions rather than long procedural scripts.

How it compares to alternatives

It occupies similar territory to more-itertools but leans more explicitly into a functional-programming philosophy, philosophically closer to languages like Clojure or Haskell than to typical Python utility libraries.

Fun fact

Its name comes from tool plus a playful Z, and it has a companion project called cytoolz that reimplements the same functions in Cython for extra speed.

New to Python and want to actually try libraries like this yourself?

Find a beginner-friendly course

Related libraries