addict
Addict is a dictionary whose items can be set using both attribute and item syntax.
What it is and what it does
addict is a dictionary subclass that lets you read and write nested values using attribute syntax instead of repeated bracket notation. Rather than `body['query']['filtered']['query']['match']['description'] = 'value'`, you write `body.query.filtered.query.match.description = 'value'`. Missing keys automatically create intermediate Dict objects (like defaultdict), so you can build deeply nested structures in a single assignment chain without pre-creating parent levels.
The package inherits from dict, so it serializes to JSON and behaves like a regular dictionary in most contexts. It also provides a `to_dict()` method to convert back to a plain dict when needed. Non-string keys must still use bracket syntax, and native dict methods (keys, items, etc.) cannot be overridden as attributes, only as items.
Use it for:
- Building Elasticsearch or other nested query structures without verbose bracket notation
- Counting by multiple levels (e.g., counting records grouped by year, gender, and eye color)
- Rapidly prototyping config objects or data structures that start simple but grow nested
- Converting flat JSON responses into navigable nested objects for cleaner code
- Creating temporary data structures within a function before converting to plain dict for external APIs
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a dictionary subclass that allows nested attribute-style access and assignment (e.g., `obj.a.b.c = value`) in addition to standard dict item syntax, with automatic creation of intermediate nested dicts.
Yes. addict is stable, actively maintained, has zero known vulnerabilities, no dependencies, and installs trivially. It solves a real readability problem for nested dict work. Install it if you regularly build or navigate deeply nested dictionaries and want cleaner syntax; skip it if you prefer explicit bracket access or rarely work with nested structures.
Install
addict on PyPI
pip
pip install addictuv
uv add addictpoetry
poetry add addictInstalling addict
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained as of March 2026 with 2546 repository stars.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package with minimal restrictions in both open-source and commercial projects.
Quickstart
from addict import Dict
mapping = Dict()
mapping.a.b.c.d.e = 2
print(mapping) # {'a': {'b': {'c': {'d': {'e': 2}}}}}
Verify before relying
- Whether Python 2.7 support is still actively tested or merely declared in classifiers
- Performance characteristics when working with very large nested structures
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 2,092 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 9,569,743/month — #1,524 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: addict-2.4.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
easydictEasyDict wraps Python dictionaries to allow…
copyleft · top 5,000 on PyPI
mo-dotsProvides null-safe dot-notation access to…
copyleft · top 15,000 on PyPI
odProvides shorthand syntax to create OrderedDict…
permissive · top 15,000 on PyPI
flatdictFlattens nested dictionaries into single-level…
permissive · top 5,000 on PyPI
jsonasobj2Converts JSON data into Python objects with…
permissive · top 15,000 on PyPI
constantdictProvides an immutable dictionary class that…
permissive · top 15,000 on PyPI
attrdictProvides dictionary-like objects that allow…
permissive · top 5,000 on PyPI
munchMunch provides a dictionary subclass that…
permissive · top 5,000 on PyPI
hydratersMerges nested Python dictionaries efficiently…
unclear · top 15,000 on PyPI