{"id":322,"library":"more-itertools","title":"More Itertools","description":"A Python package offering additional routines for working with iterables, extending beyond the standard itertools module. Current version: 10.8.0. Maintained with regular updates to enhance functionality and performance.","status":"active","version":"10.8.0","language":"python","source_language":"en","source_url":"https://github.com/more-itertools/more-itertools","tags":["iterables","itertools","python","utilities","library"],"install":[{"cmd":"pip install more-itertools","lang":"bash","label":"Install More Itertools"}],"dependencies":[{"reason":"Standard library module providing foundational iterable functions.","package":"itertools"}],"imports":[{"note":"Ensure correct import path to access the 'chunked' function.","symbol":"chunked","correct":"from more_itertools import chunked"},{"note":"Ensure correct import path to access the 'windowed' function.","symbol":"windowed","correct":"from more_itertools import windowed"}],"quickstart":{"code":"from more_itertools import chunked\n\niterable = [0, 1, 2, 3, 4, 5, 6, 7, 8]\nresult = list(chunked(iterable, 3))\nprint(result)\n\n# Output:\n# [[0, 1, 2], [3, 4, 5], [6, 7, 8]]","lang":"python","description":"Demonstrates the 'chunked' function to divide an iterable into chunks of specified size."},"warnings":[{"fix":"Upgrade to Python 3.8 or later.","message":"Python 3.7 support dropped in version 10.0.0 due to its end of life on 2023-06-27.","severity":"breaking","affected_versions":"10.0.0"},{"fix":"Update code to handle 'None' as a default return value.","message":"The 'first_true()' function now returns 'None' by default, changing its previous behavior.","severity":"breaking","affected_versions":"5.0.0"},{"fix":"Use 'itertools.batched' directly in Python 3.12+.","message":"The 'batched()' function is now an alias for 'itertools.batched' in Python 3.12 and later.","severity":"deprecated","affected_versions":"10.0.0"},{"fix":"Review and adjust usage of 'strict' parameter in 'chunked()' and 'sliced()' functions.","message":"The 'chunked()' and 'sliced()' functions now accept a 'strict' parameter, affecting their behavior.","severity":"gotcha","affected_versions":"10.7.0"}],"env_vars":null,"last_verified":"2026-05-12T13:03:32.166Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Install the package using pip: `pip install more-itertools`","cause":"The 'more-itertools' package is not installed in your Python environment.","error":"ModuleNotFoundError: No module named 'more_itertools'"},{"fix":"To get the installed version, use `pkg_resources` or `importlib.metadata` (Python 3.8+): `import pkg_resources; pkg_resources.get_distribution('more-itertools').version` or `import importlib.metadata; importlib.metadata.version('more-itertools')`","cause":"The `more_itertools` module does not expose its version via a `__version__` attribute directly within the module itself, unlike some other packages.","error":"AttributeError: module 'more_itertools' has no attribute '__version__'"},{"fix":"Either upgrade your Python version to 3.10 or newer, or import `pairwise` from `more_itertools`: `from more_itertools import pairwise` (after ensuring `more-itertools` is installed).","cause":"The `pairwise` function was added to the standard `itertools` module in Python 3.10. If you are using an older Python version (e.g., 3.9 or below), `pairwise` is only available in the `more-itertools` library.","error":"ImportError: cannot import name 'pairwise' from 'itertools'"},{"fix":"Either ensure the input iterable's length is a multiple of `n`, or remove `strict=True` to allow the last chunk to be shorter, or handle incomplete batches by setting `incomplete='fill'` or `incomplete='ignore'` (for `grouper`).","cause":"This error occurs when using `more_itertools.chunked()` (or `sliced()`) with `strict=True`, and the length of the input iterable is not perfectly divisible by the chunk size `n`.","error":"ValueError: chunked(): incomplete batch"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.03,"mem_mb":1.9,"disk_size":"18.3M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.02,"mem_mb":1.9,"disk_size":"19M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.06,"mem_mb":2.2,"disk_size":"20.2M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.04,"mem_mb":2.2,"disk_size":"21M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.06,"mem_mb":1.9,"disk_size":"12.0M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.05,"mem_mb":1.9,"disk_size":"13M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.05,"mem_mb":2.5,"disk_size":"11.6M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.05,"mem_mb":2.3,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":1.1,"disk_size":"17.8M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":1.1,"disk_size":"18M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}