About this project
DotWiz is a Python library providing a dict subclass that allows attribute-style (dot) access to keys, including automatically transformed nested dict and list values. Instead of writing my_dict['this']['dict']['has'][0]['nested']['data'], users can write dw.this.dict.has[0].nested.data.
Installation is via pip install dotwiz. The main DotWiz class accepts a dict plus optional keyword arguments, and offers to_dict() to convert back to a plain dict. A helper make_dot_wiz() builds an instance from an iterable of key-value pairs, allowing keys that are not valid Python identifiers to still be accessed through bracket notation.
DotWizPlus extends this by converting special-cased keys (spaces, mixed case, leading digits, reserved keywords, or names colliding with dict methods such as items, get, or values) into safe snake_case attribute names. Original keys remain accessible via dict-style access, and to_attr_dict() returns the sanitized attribute form.
The README claims performance advantages over alternatives such as dataclasses.make_dataclass, prodict, Box, and DotMap, with benchmark details in the documentation. The project is documented on Read the Docs, tested via GitHub Actions and Codecov, and accepts contributions through pull requests and issues.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.