boltons

When they're not builtins, they're boltons.

57 个版本 Python >=3.7
安装
pip install boltons
poetry add boltons
pipenv install boltons
conda install boltons
描述

Boltons

boltons should be builtins.

Boltons is a set of over 230 BSD-licensed, pure-Python utilities in the same spirit as — and yet conspicuously missing from — the standard library, including:

Full and extensive docs are available on Read The Docs. See what's new by checking the CHANGELOG.

Boltons is tested against Python 3.7-3.14, as well as PyPy3.

Installation

Boltons can be added to a project in a few ways. There's the obvious one:

pip install boltons

On macOS, it can also be installed via MacPorts:

sudo port install py-boltons

Then, thanks to PyPI, dozens of boltons are just an import away:

from boltons.cacheutils import LRU
my_cache = LRU()

However, due to the nature of utilities, application developers might want to consider other options, including vendorization of individual modules into a project. Boltons is pure-Python and has no dependencies. If the whole project is too big, each module is independent, and can be copied directly into a project. See the Integration section of the docs for more details.

Third-party packages

The majority of boltons strive to be "good enough" for a wide range of basic uses, leaving advanced use cases to Python's myriad specialized 3rd-party libraries. In many cases the respective boltons module will describe 3rd-party alternatives worth investigating when use cases outgrow boltons. If you've found a natural "next-step" library worth mentioning, see the next section!

Gaps

Found something missing in the standard library that should be in boltons? Found something missing in boltons? First, take a moment to read the very brief architecture statement to make sure the functionality would be a good fit. It covers the design philosophy, what belongs in boltons, and how modules are organized.

Then, if you are very motivated, submit a Pull Request. Otherwise, submit a short feature request on the Issues page, and we will figure something out.

Development

Install uv, then set up a dev environment:

uv venv && uv pip install -e .

Run the test suite (includes doctests):

uvx --with tox-uv tox -e py314

Run all environments in parallel:

uvx --with tox-uv tox -p auto
版本列表
26.0.0 2026-06-19
25.0.0 2025-02-03
24.1.0 2024-11-02
24.0.0 2024-03-31
23.1.1 2023-11-01
23.1.0 2023-10-31
23.0.0 2023-02-20
21.0.0 2021-05-17
20.2.1 2020-08-12
20.2.0 2020-06-22
20.1.0 2020-03-30
20.0.0 2020-01-08
19.3.0 2019-10-29
19.2.0 2019-10-19
19.1.0 2019-02-28
19.0.1 2019-02-13
19.0.0 2019-02-11
18.0.1 2018-08-29
18.0.0 2018-03-02
17.2.0 2017-12-16
17.1.0 2017-02-27
17.0.0 2017-01-25
16.5.1 2016-11-06
16.5.0 2016-07-19
16.4.1 2016-06-12
16.4.0 2016-06-08
16.3.1 2016-05-24
16.3.0 2016-05-23
16.2.2 2016-05-03
16.2.1 2016-04-29
16.2.0 2016-04-19
16.1.1 2016-03-06
16.1.0 2016-02-24
16.0.1 2016-02-10
16.0.0 2016-01-24
15.1.1 2015-11-19
15.1.0 2015-09-23
15.0.2 2015-09-09
15.0.1 2015-08-27
15.0.0 2015-08-19
0.6.6 2015-07-31
0.6.5 2015-07-30
0.6.4 2015-05-10
0.6.3 2015-04-20
0.6.2 2015-04-11
0.6.1 2015-04-10
0.6.0 2015-04-10
0.5.1 2015-04-10
0.5.0 2015-04-09
0.4.2 2015-03-08
0.4.2.dev0 2015-03-04
0.4.1 2015-02-26
0.4.0 2015-02-23
0.3.0 2014-10-19
0.2 2013-12-16
0.1 2013-03-23