Write files atomically so a crash never leaves a half-written file, the save either completes fully or the original stays intact.
Iterate a long list in fixed-size chunks or slide a moving window across it without writing the loop logic yourself.
Use an OrderedMultiDict to work with query strings or HTTP headers that can have multiple values for the same key while preserving order.
Copy a single boltons module file directly into your project instead of adding a library dependency, keeping your package lightweight.
Install with pip install boltons or copy a single module file directly into your project, no external dependencies required.
Boltons is a collection of more than 230 small Python utilities that fill gaps in Python's built-in standard library. The idea behind the project is that these tools feel like they should belong in Python itself but were never included. Everything is written in pure Python with no external dependencies, so it works in any environment where Python runs. The library covers a wide range of everyday programming tasks. File utilities let you save files atomically, meaning the write either completes fully or the original file stays intact, so you never get a half-written file after a crash. Dictionary and queue types go beyond what Python ships with, including an OrderedMultiDict that can hold multiple values for the same key while preserving insertion order, and two priority queue implementations. The iteration tools add functions for breaking sequences into fixed-size chunks, sliding a window across a sequence, recursively walking and transforming nested data structures, and handling retries with exponential backoff including random jitter. Boltons also includes a detailed traceback type that lets programs represent and inspect Python error stack traces as structured data objects rather than plain text strings. Because each module is independent, you do not have to take the whole library as a dependency. You can install everything with pip, or you can copy a single module file directly into your project. This approach is practical for library authors who want one specific utility without bundling the rest. The package targets Python 3.7 through 3.13, including the PyPy interpreter. Full documentation is available on Read the Docs.
← mahmoud on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.