{"id":6684,"library":"iteration-utilities","title":"Iteration Utilities","description":"iteration_utilities is a general-purpose collection of tools for functional programming based on Python's iterators and generators. It provides a wide array of functions, many inspired by the `itertools` module's recipes and the `toolz` package. Large fractions of its code are implemented in C for optimized performance. The library is under ongoing development, with the current stable version being 0.13.0, and its API may change in future releases.","status":"active","version":"0.13.0","language":"en","source_language":"en","source_url":"https://github.com/MSeifert04/iteration_utilities.git","tags":["iterators","generators","functional-programming","utilities","performance","itertools-recipes"],"install":[{"cmd":"pip install iteration-utilities","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Requires Python 3.7 or newer to run.","package":"Python","optional":false},{"reason":"Required for building from source as it contains C extensions, though pre-built wheels are usually available.","package":"C compiler","optional":true}],"imports":[{"note":"A convenience class for chaining iteration_utilities functions.","symbol":"Iterable","correct":"from iteration_utilities import Iterable"},{"note":"Many functions are imported directly from the top-level package.","symbol":"deepflatten","correct":"from iteration_utilities import deepflatten"}],"quickstart":{"code":"from iteration_utilities import Iterable, duplicates, all_distinct\n\n# Example 1: Chaining operations with Iterable\ndata = [1, 2, 2, 3, 4, 4, 5, 5, 5]\nprocessed_data = Iterable(data).filter(lambda x: x % 2 == 0).unique_everseen().as_list()\nprint(f\"Processed even unique data: {processed_data}\")\n\n# Example 2: Using a standalone function like duplicates\nduplicate_items = list(duplicates(data))\nprint(f\"Duplicate items: {duplicate_items}\")\n\n# Example 3: Using all_distinct\nis_all_distinct = all_distinct([1, 2, 3, 4])\nis_not_distinct = all_distinct([1, 2, 2, 3])\nprint(f\"[1, 2, 3, 4] all distinct? {is_all_distinct}\")\nprint(f\"[1, 2, 2, 3] all distinct? {is_not_distinct}\")","lang":"python","description":"Demonstrates basic usage of the `Iterable` class for chaining methods and direct imports of utility functions like `duplicates` and `all_distinct`."},"warnings":[{"fix":"Refer to the latest documentation and changelog for each major or minor release.","message":"The library is under ongoing development, and its API is subject to change. Functions or their signatures may be altered in future versions.","severity":"breaking","affected_versions":"All versions"},{"fix":"Upgrade to Python 3.7 or newer if using versions 0.12.0 or later.","message":"Support 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.","severity":"breaking","affected_versions":"0.12.0+"},{"fix":"Replace `iteration_utilities.__version__` with `importlib.metadata.version('iteration-utilities')`.","message":"The top-level `__version__` property was removed. To get the library's version, use `importlib.metadata.version` from the Python standard library.","severity":"deprecated","affected_versions":"0.12.0+"},{"fix":"Be aware of potential performance implications if targeting Python 3.13 with performance-critical code utilizing these specific functions.","message":"Some functions, notably `groupedby`, may experience slightly reduced performance in Python 3.13 due to changes in optimizations.","severity":"gotcha","affected_versions":"0.13.0+ on Python 3.13"},{"fix":"Adjust usage of `partial` with keyword arguments and remove references to previously available private constants. Refer to the 0.8.0 changelog.","message":"In 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.","severity":"breaking","affected_versions":"0.8.0+"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}