Description
DotMap is a Python library that lets you read and write dictionary keys with dot access. It subclasses dict, so it works anywhere a normal dictionary does, and it keeps keys in insertion order. Its main feature is dynamic hierarchy creation: setting a nested key creates the levels above it automatically. You can turn that off by initializing with _dynamic=False, or use StaticDotMap for a fixed structure. DotMap can be created from a dict and converted back to one, and it can take a factory for default values of missing keys, which works like collections.defaultdict. It also has automatic counter and addition initialization, and a built-in pretty printer that shows it as a dict or as JSON, which helps when you are debugging a large structure. The README covers installation and how to upgrade an existing installation. The source is public on GitHub.…
Highlights
- Dot access to dictionary keys
- Automatic nested hierarchy creation
- Keys kept in insertion order
- Converts to and from plain dict
- Default factories and pretty printing
Ratings & Reviews
No ratings yet
Be the first to rate Dotmap.
People also visit
Python Benedict
dict subclass with keylist/keypath support, built-in I/O operations
Dotmap FAQ
What is DotMap?
A Python library that wraps a dictionary so you can use dot notation to read and write its keys.
Is a DotMap still a dict?
Yes. It is a dict subclass, so you can use it like one and convert it to a plain dict when needed.
How do I turn off automatic nesting?
Initialize it with _dynamic=False, or use StaticDotMap for a structure that does not create keys on access.
Does it keep the order of my keys?
Yes. Iteration follows the order in which keys were inserted.
How do I install it?
Follow the install command in the project README. The README also shows how to upgrade an existing installation.
What are the best Dotmap alternatives?
Popular alternatives to Dotmap include Workerskv.gui, NonBlocking and GitMap. See all Dotmap alternatives
