skillfed

addict

Addict is a dictionary whose items can be set using both attribute and item syntax.

addict v2.4.0 9.6M downloads/30d#1,524 on PyPI2,546
Permissive license Active released

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 addict

uv

uv add addict

poetry

poetry add addict

Installing 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

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

attribute access dictionarynested dict with dot notationdict attribute syntaxdefaultdict with attributeseasy nested dictionary creation
data-structuresdict-wrapper

More Python Modules packages