Registry / data / toolz
library1.1.0pypypi✓ verified 26d ago

toolz is a Python library providing a collection of utility functions for iterators, functions, and dictionaries, extending Python's standard `itertools` and `functools`. It promotes a functional programming style with features like composable, pure, and lazy operations. The current version is 1.1.0, and while the project is alive and maintained for critical bug fixes and Python version bumps, it is generally considered 'inactive' by its maintainers, who view it as mostly complete.

pip install toolz
INSTALL
IMPORT
SIG · TOOLZ
T
toolz
datapythonv1.1.0
Install
1.6s avg
Import
49ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.050s · 18.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.048s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

compose
from toolz import compose
Commonly imported directly for function composition.
frequencies
from toolz import frequencies
A useful function for counting element occurrences.
map
from toolz.curried import map
from toolz import map
The `map` in `toolz.curried` is pre-curried, allowing partial application. The top-level `toolz.map` behaves like Python 3's built-in `map` (lazy iterator), which might be confused with Python 2's eager `map`.
groupby
from toolz.itertoolz import groupby
Functions from `itertoolz`, `functoolz`, and `dicttoolz` can be imported from their specific submodules or accessed via a general `import toolz`.

This example demonstrates how to build a word counting function using `compose`, `frequencies`, and the curried `map` from `toolz` to process a sentence.

from toolz import compose, frequencies from toolz.curried import map def stem(word): """ Stem word to primitive form """ return word.lower().rstrip(",.!:;'-\"").lstrip("'\"") wordcount = compose(frequencies, map(stem), str.split) sentence = "This cat jumped over this other cat!" result = wordcount(sentence) print(result) # Expected: {'this': 2, 'cat': 2, 'jumped': 1, 'over': 1, 'other': 1}
Debug
Known issues
gotchaMany functions, especially within `itertoolz`, are 'lazy operators' and return iterators. Their results are not computed until explicitly consumed (e.g., by wrapping with `list()`, `tuple()`, or iterating over them). Expecting immediate list-like results without explicit conversion can lead to unexpected behavior or empty outputs.
fix
Always wrap lazy function calls with `list()`, `tuple()`, or iterate over them if an immediate, concrete collection is required, e.g., `my_list = list(toolz.itertoolz.filter(predicate, sequence))`.
affects: All versions
gotcha`toolz` has a high-performance Cython-based counterpart called `cytoolz`. If performance is critical, `cytoolz` is a drop-in replacement that offers the same API with C-optimized speed.
fix
To use the faster implementation, `pip install cytoolz`. Ensure `cytoolz` is installed in your environment, and `toolz` functions will often defer to the Cython versions if available.
affects: All versions
breakingAs of version 1.1.0, `toolz` officially dropped support for Python 3.8 and PyPy 3.8.
fix
Upgrade your Python environment to Python 3.9 or newer. For projects requiring Python 3.8, use an older `toolz` version (e.g., 1.0.0 or earlier).
affects: 1.1.0 and later
deprecatedThe `toolz` project is described as 'alive but inactive' by its maintainers. While critical bug fixes and Python version bumps are addressed, active feature development and review of new contributions are not a primary focus, as the library is considered 'mostly complete'.
fix
Be aware that new features or significant API changes are unlikely. Rely on the existing, stable API. Contribute bug fixes or compatibility updates if needed, but major feature proposals might not be integrated.
affects: All versions (future feature development)
Upgrade
Version history
1.1.0latest on PyPI · released Oct 17, 2025
Audit
Dependencies
PythonrequiredRequires Python 3.9 or higher for version 1.1.0.
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
1
Resources