# Box: Python Dictionaries with Advanced Dot Notation Access

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/cdgriffith-box
Generated for open source discovery and AI-assisted research.

Box is a powerful Python library that enhances standard dictionaries with advanced dot notation access. It acts as a near-transparent drop-in replacement, automatically converting nested dictionaries and lists for recursive attribute-style access. This makes working with complex data structures significantly more intuitive and efficient.

GitHub: https://github.com/cdgriffith/Box
OSRepos URL: https://osrepos.com/repo/cdgriffith-box

## Summary

Box is a powerful Python library that enhances standard dictionaries with advanced dot notation access. It acts as a near-transparent drop-in replacement, automatically converting nested dictionaries and lists for recursive attribute-style access. This makes working with complex data structures significantly more intuitive and efficient.

## Topics

- Python
- Dictionaries
- Dot Notation
- Data Structures
- Python Library
- Utility
- Box
- Pypi

## Repository Information

Last analyzed by OSRepos: Thu Dec 04 2025 20:00:47 GMT+0000 (Western European Standard Time)
Detail views: 5
GitHub clicks: 6

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction

Box is a versatile Python library that provides an enhanced dictionary experience, allowing for advanced dot notation access to your data. It serves as a near-transparent drop-in replacement for standard Python dictionaries, making it significantly easier and more intuitive to interact with complex, nested data structures. As a subclass of `dict`, Box ensures compatibility while introducing powerful features like automatic conversion of nested dictionaries and lists into `Box` and `BoxList` objects, respectively, enabling recursive attribute-style access.

## Installation

Installing Box is straightforward using pip. It is highly recommended to pin your library versions to avoid unexpected breaking changes between major releases.

To install Box with all its optional dependencies (for YAML, TOML, and msgpack support), use the following command:

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


For specific dependencies, you can choose them individually:

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


Box also includes Cython optimizations for major platforms, which can significantly speed up the loading of large datasets. If you encounter a warning about Cython during installation on unsupported systems, you may need to install Python development files, a system compiler, and the `Cython` and `wheel` packages before reinstalling Box.

## Examples

Box simplifies data access dramatically. Here's a quick example demonstrating its core functionality:

python
from box import Box

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

# Access data using dot notation
print(movie_box.Robin_Hood_Men_in_Tights.imdb_stars)
# Output: 6.7

# Box automatically makes otherwise inaccessible keys safe to access as an attribute.
# You can always pass `conversion_box=False` to `Box` to disable that behavior.


Any new dictionaries or lists added to a `Box` or `BoxList` object are automatically converted, allowing for seamless recursive dot notation access throughout your data.

## Why Use Box

Box offers several compelling reasons to integrate it into your Python projects:

*   **Intuitive Data Access**: Simplifies interaction with nested dictionaries through easy-to-read dot notation, eliminating repetitive bracket syntax.
*   **Recursive Conversion**: Automatically converts all sub-dictionaries and lists into `Box` and `BoxList` objects, maintaining attribute-style access throughout your entire data structure.
*   **Performance**: Includes Cython optimizations that can make loading large datasets up to 10 times faster on supported platforms.
*   **Versatile Converters**: Provides helper functions to easily transform Box objects back into standard dictionaries, or export them to various formats like JSON, YAML, TOML, or msgpack strings and files.
*   **Customization**: Offers numerous ways to customize its behavior with different types of boxes, allowing you to tailor it precisely to your specific needs.

## Links

*   **GitHub Repository**: [https://github.com/cdgriffith/Box](https://github.com/cdgriffith/Box){:target="_blank"}
*   **Official Wiki**: [https://github.com/cdgriffith/Box/wiki](https://github.com/cdgriffith/Box/wiki){:target="_blank"}
*   **PyPI Project**: [https://pypi.org/project/python-box/](https://pypi.org/project/python-box/){:target="_blank"}
*   **License**: [https://github.com/cdgriffith/Box/blob/master/LICENSE](https://github.com/cdgriffith/Box/blob/master/LICENSE){:target="_blank"}