Skip to main content

BuildStatus License

BoxImage

from box import Box

movie_box = Box({ "Robin Hood: Men in Tights": { "imdb stars": 6.7, "length": 104 } })

movie_box.Robin_Hood_Men_in_Tights.imdb_stars
# 6.7

Box will automatically make otherwise inaccessible keys safe to access as an attribute. You can always pass conversion_box=False to Box to disable that behavior. Also, all new dict and lists added to a Box or BoxList object are converted automatically.

There are over a half dozen ways to customize your Box and make it work for you.

Check out the new Box github wiki for more details and examples!

Install

Version Pin Your Box!

If you aren’t in the habit of version pinning your libraries, it will eventually bite you. Box has a list of breaking change between major versions you should always check out before updating.

requirements.txt

python-box[all]~=7.0

As Box adheres to semantic versioning (aka API changes will only occur on between major version), it is best to use Compatible release matching using the ~= clause.

Install from command line

python -m pip install --upgrade pip
pip install python-box[all]~=7.0 --upgrade

Install with selected dependencies

Box does not install external dependencies such as yaml and toml writers. Instead you can specify which you want, for example, [all] is shorthand for:

pip install python-box[ruamel.yaml,tomli_w,msgpack]~=7.0 --upgrade

But you can also sub out ruamel.yaml for PyYAML.

Check out more details on installation details.

Box 7 is tested on python 3.7+, if you are upgrading from previous versions, please look through any breaking changes and new features.

Optimized Version

Box has introduced Cython optimizations for major platforms by default. Loading large data sets can be up to 10x faster!

If you are not on a x86_64 supported system you will need to do some extra work to install the optimized version. There will be an warning of “WARNING: Cython not installed, could not optimize box” during install. You will need python development files, system compiler, and the python packages Cython and wheel.

Linux Example:

First make sure you have python development files installed (python3-dev or python3-devel in most repos). You will then need Cython and wheel installed and then install (or re-install with –force) python-box.

pip install Cython wheel
pip install python-box[all]~=7.0 --upgrade --force

If you have any issues please open a github issue with the error you are experiencing!

Overview

Box is designed to be a near transparent drop in replacements for dictionaries that add dot notation access and other powerful feature.

There are a lot of types of boxes to customize it for your needs, as well as handy converters!

Keep in mind any sub dictionaries or ones set after initiation will be automatically converted to a Box object, and lists will be converted to BoxList, all other objects stay intact.

Check out the Quick Start for more in depth details.

Box can be instantiated the same ways as dict.

Box({'data': 2, 'count': 5})
Box(data=2, count=5)
Box({'data': 2, 'count': 1}, count=5)
Box([('data', 2), ('count', 5)])

# All will create
# <Box: {'data': 2, 'count': 5}>

Box is a subclass of dict which overrides some base functionality to make sure everything stored in the dict can be accessed as an attribute or key value.

small_box = Box({'data': 2, 'count': 5})
small_box.data == small_box['data'] == getattr(small_box, 'data')

All dicts (and lists) added to a Box will be converted on insertion to a Box (or BoxList), allowing for recursive dot notation access.

Box also includes helper functions to transform it back into a dict, as well as into JSON, YAML, TOML, or msgpack strings or files.

Thanks

A huge thank you to everyone that has given features and feedback over the years to Box! Check out everyone that has contributed.

A big thanks to Python Software Foundation, and PSF-Trademarks Committee, for official approval to use the Python logo on the Box logo!

Also special shout-out to PythonBytes, who featured Box on their podcast.

License

MIT License, Copyright (c) 2017-2026 Chris Griffith. See LICENSE file.

Metadata

Release files for python-box 7.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-box 7.4.1
File Size Uploaded
python_box-7.4.1.tar.gz 49.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for python-box 7.4.1
File
python_box-7.4.1-py3-none-any.whl Python 3 none any Details
python_box-7.4.1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
python_box-7.4.1-cp314-cp314-macosx_10_15_universal2.whl CPython 3.14 CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64) Details
python_box-7.4.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
python_box-7.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
python_box-7.4.1-cp313-cp313-macosx_10_13_universal2.whl CPython 3.13 CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) Details
python_box-7.4.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
python_box-7.4.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
python_box-7.4.1-cp312-cp312-macosx_10_13_universal2.whl CPython 3.12 CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) Details
python_box-7.4.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
python_box-7.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
python_box-7.4.1-cp311-cp311-macosx_10_9_universal2.whl CPython 3.11 CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) Details
python_box-7.4.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
python_box-7.4.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
python_box-7.4.1-cp310-cp310-macosx_10_9_universal2.whl CPython 3.10 CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) Details

Total release size: 33.7 MB

Release files / python_box-7.4.1.tar.gz

Download URL python_box-7.4.1.tar.gz
Size 49.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e412e36c25fca8223560516d53ef6c7993591c3b0ec8bb4ec582bf7defdd79f0
BLAKE2b-256 checksum
How to use checksums
0f0f34e7ee0a72f1464b4c7a2e8bafb389f230477256af586bc82bcfad85295a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / python_box-7.4.1-py3-none-any.whl

Download URL python_box-7.4.1-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3b0d84d003882fb6abe505b1b883b3a5dcbf226b0fe168d24bc5ff75d9826e5
BLAKE2b-256 checksum
How to use checksums
06a65d3f3abf46b37aa44b1f6788d287c8b4f2319b55013191dddf25b9e6d62c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / python_box-7.4.1-cp314-cp314-win_amd64.whl

Download URL python_box-7.4.1-cp314-cp314-win_amd64.whl
Size 1.3 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
ae8c540a0457f52350211d24690211251912018e1e0c1857f50792729d6f562c
BLAKE2b-256 checksum
How to use checksums
a65f0e7ea7640ba60ff459ce37e340d816ac5e91b7a9a7c3c161f9dabe622be6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / python_box-7.4.1-cp314-cp314-macosx_10_15_universal2.whl

Download URL python_box-7.4.1-cp314-cp314-macosx_10_15_universal2.whl
Size 1.9 MB
Tags CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
33c6701faa51fd87f0dcc538873c0fad2b3a1cc3750eab85835cd071cadf1948
BLAKE2b-256 checksum
How to use checksums
94a2771b5e526bba2214ac2d30e321209a66680c40788616a45cf01005e95204
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / python_box-7.4.1-cp313-cp313-win_amd64.whl

Download URL python_box-7.4.1-cp313-cp313-win_amd64.whl
Size 1.3 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
615da3fafd41572aec1b905832555c0ea08b6fbc27cc917356e257a9a5721af7
BLAKE2b-256 checksum
How to use checksums
171d7a1e04f37674399e0f3076cfe1fa358f6a51540ae98299a06f2c0424c471
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / python_box-7.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL python_box-7.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 4.5 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
bb204822c7638bd2dbed5c55d6ab264c6903c37d18dee5c45bdbda58b2e1e17a
BLAKE2b-256 checksum
How to use checksums
da7948d38c855f277223caf3aa79518476f95abc07f04386940855b7bd3d95f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / python_box-7.4.1-cp313-cp313-macosx_10_13_universal2.whl

Download URL python_box-7.4.1-cp313-cp313-macosx_10_13_universal2.whl
Size 1.8 MB
Tags CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
85db37b43094bf6c4884b931fb149a7850db5ce331f6e191edf98b453e6cf2d6
BLAKE2b-256 checksum
How to use checksums
ece948d1b1eb21efc3f82a31b037b6903c9139018f686d96d251faa4cb0d593a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / python_box-7.4.1-cp312-cp312-win_amd64.whl

Download URL python_box-7.4.1-cp312-cp312-win_amd64.whl
Size 1.3 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
2ca9a18fd15326bc267e9cc7e0e6e3a0cb78d11507940f43f687adf7e156d882
BLAKE2b-256 checksum
How to use checksums
65f95de3c18415dd6f5286f00e6539c0ae3cceb1c6aaf28d1d5f17b0b568c97f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / python_box-7.4.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL python_box-7.4.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 4.5 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b7f977f00e715b030cee6ffef2322ff8ce100ffbf1dbcc4ef91099c75752d5f8
BLAKE2b-256 checksum
How to use checksums
baa3383eb3d658f36c6e531c8cf1e348ccb4b5031231df4aeb7742bb159a3166
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / python_box-7.4.1-cp312-cp312-macosx_10_13_universal2.whl

Download URL python_box-7.4.1-cp312-cp312-macosx_10_13_universal2.whl
Size 1.8 MB
Tags CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
dfb91effff00d9e23486c4f0db3b19e03d602ebb7c9e20fc6a287c704fad2552
BLAKE2b-256 checksum
How to use checksums
4dd9d05f317b38b42253422d8483f5d7dc16d382c99ddc253e426639a0f2f235
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / python_box-7.4.1-cp311-cp311-win_amd64.whl

Download URL python_box-7.4.1-cp311-cp311-win_amd64.whl
Size 1.3 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
43c62f66d694eb6410f51eb2eb5726f9b466e6f685e5dc90b5cd11f7b3047362
BLAKE2b-256 checksum
How to use checksums
8ccfb9d1d4550615f69f6f9c72767f026543442739e5c56adf6f844b50d88251
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / python_box-7.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL python_box-7.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 4.5 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c66582f41a94d46cb0896d468b0efebf9bc4c3a5634cd15373d871767c2e741d
BLAKE2b-256 checksum
How to use checksums
0fbc9382766d388e258363a18a094e251d2624e3c524614c733d1afa989d9770
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / python_box-7.4.1-cp311-cp311-macosx_10_9_universal2.whl

Download URL python_box-7.4.1-cp311-cp311-macosx_10_9_universal2.whl
Size 1.9 MB
Tags CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
3f76dad8be9d57d65a3edc792b952f7afe3991515aa6eba616cf5efb2fbb2e0c
BLAKE2b-256 checksum
How to use checksums
f8a8c8bcd3ff0905ec549273ea3485e6b9f2039f57baab419123fb18f964f829
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / python_box-7.4.1-cp310-cp310-win_amd64.whl

Download URL python_box-7.4.1-cp310-cp310-win_amd64.whl
Size 1.3 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
526dcc3d82a6957b177313e8704ede431b9add0209b76d716eb232c9a5d283e5
BLAKE2b-256 checksum
How to use checksums
479494690a217ecb1333a8d796698176456bc03cdf707d903a6bd1aab022a497
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / python_box-7.4.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL python_box-7.4.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 4.3 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ee7bb8b0c4d1a07f12454a1edc1a936c4bf952adead3eb40c38aee600a2b605b
BLAKE2b-256 checksum
How to use checksums
5ad0e211693f3ac4f11b553f214fcf2a2687be42052ad6905832258d451003b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / python_box-7.4.1-cp310-cp310-macosx_10_9_universal2.whl

Download URL python_box-7.4.1-cp310-cp310-macosx_10_9_universal2.whl
Size 1.9 MB
Tags CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
e724eb25bfda0f1dbbe79c8a35ce8877d8ad7afbdd9396757c6f509f0e742f8c
BLAKE2b-256 checksum
How to use checksums
f67f0ff288dedf965f504de7a8d9d7353f7b7e57bf18ce9beb328bad49dff026
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release history Release notifications | RSS feed

This release

7.4.1 This release

16 release files

7.3.3

16 release files

7.3.2

17 release files

7.3.1

17 release files

7.3.0

17 release files

7.2.0

17 release files

7.1.1

14 release files

7.1.0

10 release files

7.0.1

16 release files

6.1.0

17 release files

6.0.1

14 release files

6.0.0

14 release files

5.4.1

2 release files

5.4.0

2 release files

5.3.0

2 release files

5.2.0

2 release files

5.1.1

2 release files

5.1.0

2 release files

5.0.1

2 release files

5.0.0

2 release files

4.2.3

2 release files

4.2.2

2 release files

4.2.1

2 release files

4.2.0

2 release files

4.1.0

2 release files

4.0.4

2 release files

4.0.3

2 release files

4.0.2

2 release files

4.0.1

2 release files

3.4.6

2 release files

3.4.5

2 release files

3.4.4

2 release files

3.4.3

2 release files

3.4.2

2 release files

3.4.1

2 release files

3.4.0

2 release files

3.3.0

2 release files

3.2.4

3 release files

3.2.3

3 release files

3.2.2

3 release files

3.2.1

3 release files

3.2.0

3 release files

3.1.1

3 release files

3.1.0

3 release files

3.0.1

3 release files

3.0.0

3 release files

2.2.1

3 release files

2.2.0

3 release files

2.1.0

3 release files

2.0.0

3 release files

1.0.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page