--- id: python-box version: "7.4.1" license: MIT license_treatment: permissive maintenance: active --- # python-box — Advanced Python dictionaries with dot notation access License: permissive · Maintenance: active · Downloads: 7.3M/mo ## What it is and what it does Box is a dict subclass that makes nested dictionary data accessible via dot notation instead of bracket syntax. When you create a Box, any nested dicts are automatically converted to Box objects and lists to BoxList objects, allowing you to write `box.key.nested_key` instead of `box['key']['nested_key']`. Keys with special characters or spaces are normalized to valid Python identifiers, making otherwise inaccessible keys safe to reference as attributes. The package is designed as a transparent drop-in replacement for dict with optional customization. It supports initialization the same way as dict (keyword args, iterables, or other dicts), includes helper methods to convert back to plain dicts or serialize to JSON, YAML, TOML, or msgpack, and optionally uses Cython compilation for performance on supported platforms. It has no external runtime dependencies by default, though optional extras like ruamel.yaml or tomli_w can be installed for format support. Use it for: - Parse and traverse JSON or API responses using dot notation instead of repeated bracket indexing - Convert configuration files (YAML, TOML) into objects with attribute access for cleaner code - Build nested data structures programmatically while maintaining dict compatibility with existing code - Simplify data access in scripts where bracket syntax becomes verbose or hard to read - Serialize Python objects back to JSON or other formats while preserving structure ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Box wraps Python dictionaries to enable dot-notation attribute access on keys, automatically converting nested dicts and lists while remaining a dict subclass. Yes. Box is stable, actively maintained, has zero known vulnerabilities, installs with no dependencies, and solves a genuine readability problem for nested dict access. The MIT license imposes no restrictions. Install it if you work regularly with nested dicts or config data and want cleaner syntax; skip it only if you prefer strict dict semantics or have a strong style preference against attribute access. ## Install pip install python-box uv add python-box poetry add python-box ## Installing python-box Before you install: Low friction install with no runtime dependencies. Actively maintained with recent releases; supports Python 3.9 and newer including current versions. Optional Cython optimization available for faster large-dataset handling on supported platforms. License in practice: MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations. Quickstart: from box import Box movie_box = Box({"Robin Hood: Men in Tights": {"imdb stars": 6.7, "length": 104}}) print(movie_box.Robin_Hood_Men_in_Tights.imdb_stars) # 6.7 Verify before relying: - Whether Cython optimization is automatically applied on x86_64 systems or requires manual installation - Performance characteristics for very large nested structures beyond the stated 10x speedup claim ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 7.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags dot notation dictionary access, dict attribute access, nested dict traversal, python dict wrapper, key-value attribute syntax, dict to object conversion, safe key access, dict-wrapper, data-access [View on SkillFed](https://skillfed.io/packages/python-box) · [View on PyPI](https://pypi.org/project/python-box/)