more-itertools
More routines for operating on iterables, beyond Python's built-in itertools
Repository Health
Technical Analysis
more-itertools extends Python’s standard library itertools module with a large collection of additional iterator-processing functions — chunking, windowing, grouping, peeking, deduplication, flattening, and dozens of other recipes for working with iterables efficiently and lazily. Many of the functions originate from the “itertools recipes” section of the official Python documentation, formalized and battle-tested into a stable public API.
Because it fills gaps left by the standard library without introducing heavyweight dependencies, more-itertools is one of the most widely used utility packages in the Python ecosystem (tens of millions of weekly downloads), commonly pulled in transitively by tools like pip, Sphinx, and other core Python infrastructure.
What You Get
- Chunking and windowing functions (
chunked,sliding_window,windowed,ichunked) for processing iterables in fixed-size or overlapping groups - Peeking and lookahead utilities (
peekable,spy,first,last) for inspecting upcoming items without consuming the iterator - Grouping and partitioning functions (
bucket,partition,split_at,split_before,split_after) for splitting a stream by predicate - Deduplication and set-like operations (
unique_everseen,unique_justseen,duplicates_everseen) that preserve original ordering - Flattening and combining utilities (
flatten,collapse,interleave,roundrobin,zip_broadcast) for working with nested or multiple iterables - A
numeric_rangegeneralizing the built-inrange()to floats and other numeric types
Common Use Cases
- Data pipeline code that needs to process large or infinite iterables in fixed-size batches without loading everything into memory
- CLI tools and scripts implementing lookahead parsing logic using
peekableinstead of manually buffering items - Deduplicating a stream of records while preserving order, without the overhead of sorting or a full set-based approach
- Splitting a sequence into groups by a predicate (e.g. runs of consecutive items) for report generation or log analysis
Under The Hood
Architecture: The library deliberately has just two source modules — more_itertools/recipes.py (1,620 lines, implementing the documented itertools recipes) and more_itertools/more.py (5,557 lines, the larger set of original additions) — both re-exported flatly through more_itertools/__init__.py, so the entire public API is a single flat namespace with no submodule structure to learn. Tech Stack: Pure Python 3.10+ with zero runtime dependencies, built with Flit (flit_core build backend) rather than setuptools, keeping the packaging surface minimal; a requirements/ directory separates dev/test/docs dependency sets. Code Quality: Despite the large function count, the tests/ directory (organized into a handful of test modules covering recipes and more separately) maintains extensive doctest coverage embedded directly in each function’s docstring in addition to standalone unit tests — a pattern that keeps documentation and correctness verification tied together; the project has a long, consistent release history and 40k+ lines of README documenting every function with runnable examples. API Design: Every function follows itertools’ own conventions (lazy iterator returns, composable with itertools functions directly, consistent keyword-argument naming across similar functions like chunked/sliced/windowed), so users already familiar with itertools can adopt new functions with minimal additional learning.
Used by 6 apps in this directory
Apache Airflow
Data Engineering
Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.
ClickHouse
Databases · Analytics · Data Engineering
Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.
OSV.dev
Security
Google's open-source vulnerability database that maps CVEs to exact package versions across 50+ ecosystems with a public API and data dumps.
PostHog
Analytics · Monitoring · Developer Tools
The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.
Qdrant
Databases · AI Development · Search
Open-source vector database and search engine built in Rust for production-grade AI applications — from semantic search to RAG pipelines and recommendation systems.
Taiga Back
Project Management · Developer Tools
Self-hosted agile project management backend with Scrum, Kanban, issue tracking, and a full REST API — built on Django and PostgreSQL.