Install & Compatibility
Where this runs
tested against v0.13.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
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.046s · 19.6MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 1.6s · import 0.038s · 20MB
18MB installed
● package 18MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Iterable
✓ from iteration_utilities import Iterable
A convenience class for chaining iteration_utilities functions.
deepflatten
✓ from iteration_utilities import deepflatten
Many functions are imported directly from the top-level package.
Demonstrates basic usage of the `Iterable` class for chaining methods and direct imports of utility functions like `duplicates` and `all_distinct`.
from iteration_utilities import Iterable, duplicates, all_distinct
# Example 1: Chaining operations with Iterable
data = [1, 2, 2, 3, 4, 4, 5, 5, 5]
processed_data = Iterable(data).filter(lambda x: x % 2 == 0).unique_everseen().as_list()
print(f"Processed even unique data: {processed_data}")
# Example 2: Using a standalone function like duplicates
duplicate_items = list(duplicates(data))
print(f"Duplicate items: {duplicate_items}")
# Example 3: Using all_distinct
is_all_distinct = all_distinct([1, 2, 3, 4])
is_not_distinct = all_distinct([1, 2, 2, 3])
print(f"[1, 2, 3, 4] all distinct? {is_all_distinct}")
print(f"[1, 2, 2, 3] all distinct? {is_not_distinct}")
Debug
Known issues
breakingThe library is under ongoing development, and its API is subject to change. Functions or their signatures may be altered in future versions.fixRefer to the latest documentation and changelog for each major or minor release.
affects: All versions
breakingSupport for older Python versions is periodically dropped. Python 3.5 and 3.6 compatibility was removed in version 0.12.0. Ensure your Python environment meets the 'Python >=3.7' requirement.fixUpgrade to Python 3.7 or newer if using versions 0.12.0 or later.
affects: 0.12.0+
deprecatedThe top-level `__version__` property was removed. To get the library's version, use `importlib.metadata.version` from the Python standard library.fixReplace `iteration_utilities.__version__` with `importlib.metadata.version('iteration-utilities')`. affects: 0.12.0+
gotchaSome functions, notably `groupedby`, may experience slightly reduced performance in Python 3.13 due to changes in optimizations.fixBe aware of potential performance implications if targeting Python 3.13 with performance-critical code utilizing these specific functions.
affects: 0.13.0+ on Python 3.13
breakingIn version 0.8.0, the `partial` function (if used) began allowing only plain string keyword-names in CPython 3.8. Additionally, private constants (e.g., `EQ_PY2`, `GE_PY3`) were removed from the module namespace.fixAdjust usage of `partial` with keyword arguments and remove references to previously available private constants. Refer to the 0.8.0 changelog.
affects: 0.8.0+
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'iteration_utilities'
The 'iteration-utilities' package is not installed in the current Python environment or the environment is not correctly activated.
fixpip install iteration-utilities
ValueError: Expected exactly one item in iterable but got 0.
The `iteration_utilities.one()` function was called with an iterable that contained no items, but it requires an iterable with precisely one element.
fixEnsure the iterable passed to `one()` always contains exactly one element, or use error handling for empty iterables, for example: `from iteration_utilities import one; item = one([1])`.
TypeError: 'int' object is not iterable
An `iteration_utilities` function, such as `all_equal()`, was called with an argument that is not an iterable (e.g., an integer), but it expects an iterable (like a list, tuple, or generator).
fixPass an iterable object to the function. For example, instead of `all_equal(5)`, use `all_equal([5])` or `all_equal((5,))`.
Upgrade
Version history
0.13.0latest on PyPI · released Oct 8, 2024
Audit
Dependencies
PythonrequiredRequires Python 3.7 or newer to run.
C compileroptionalRequired for building from source as it contains C extensions, though pre-built wheels are usually available.