attrdict
A dict with attribute-style access
What it is and what it does
AttrDict wraps Python dictionaries to allow accessing values as object attributes instead of only as keys. For example, a dict {'foo': 'bar'} can be accessed as obj.foo instead of obj['foo']. The package provides three classes—AttrMap, AttrDict, and AttrDefault—each with slightly different behavior; AttrDict subclasses dict itself, AttrMap is a lighter MutableMapping, and AttrDefault behaves like defaultdict with automatic key creation. By default, nested dicts and sequences are recursively converted to Attr objects, so you can chain attribute access: obj.settings.db.host works naturally.
The main use case is building hierarchical configuration or settings objects from YAML, JSON, or nested dicts, where dot notation is more readable than repeated bracket access. The package is small, has low install friction, and depends only on six. However, it has been archived since 2019 with no active maintenance, so compatibility with modern Python versions and edge cases discovered after that date are not guaranteed.
Use it for:
- Loading and accessing YAML configuration files as nested attribute objects instead of deeply nested dict lookups.
- Building hierarchical settings objects where database credentials, API keys, and other config live in nested dicts accessed via dot notation.
- Converting API responses (JSON dicts) into objects with attribute access for cleaner, more readable client code.
- Merging multiple configuration dicts using the + operator with automatic recursive merging of nested structures.
- Creating on-the-fly attribute objects from unstructured data where missing keys should auto-create with a default factory (AttrDefault).
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides dictionary-like objects that allow accessing and modifying elements using both attribute notation (obj.key) and bracket notation (obj['key']), with automatic recursive conversion of nested dicts and sequences.
Yes, if you are working in a codebase already using it or need lightweight attribute-style dict access in a stable, unchanging environment. No, if you require active maintenance, Python version compatibility assurance, or expect to rely on bug fixes—the package is archived and unmaintained since 2019. For new projects, consider whether a modern alternative better fits your maintenance and compatibility expectations.
Install
attrdict on PyPI
pip
pip install attrdictuv
uv add attrdictpoetry
poetry add attrdictInstalling attrdict
Before you install
Installation is straightforward with no compiled dependencies. However, the package is archived and has not been maintained since 2019—over six years without updates. While it depends only on six, the lack of maintenance means no fixes for Python version changes or edge cases discovered after the last release.
License in practice
Released under the MIT License, which is permissive and imposes no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install attrdict
from attrdict import AttrDict
a = AttrDict({'foo': 'bar'})
print(a.foo) # 'bar'
print(a['foo']) # 'bar'
Verify before relying
- Whether the package remains compatible with Python versions released after 2019 without active testing or maintenance.
- Whether recursive assignment limitations documented for AttrDict (shallow-copy caveat) affect real-world usage patterns significantly.
Package facts
| License | MIT License (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — six |
| Maintenance | abandoned — 2,751 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 1,781,236/month — #3,568 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: attrdict-2.0.1-py2.py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
configProvides hierarchical configuration management…
permissive · top 5,000 on PyPI
flatdictFlattens nested dictionaries into single-level…
permissive · top 5,000 on PyPI
dicttoxmlConverts Python dictionaries and other native…
copyleft · top 5,000 on PyPI
super-collectionsConverts nested JSON and YAML data into Python…
permissive · top 5,000 on PyPI
zictProvides mutable mapping tools and data…
permissive · top 5,000 on PyPI
python-boxBox wraps Python dictionaries to enable…
permissive · top 5,000 on PyPI
attrA decorator that attaches metadata attributes…
permissive · top 15,000 on PyPI
odProvides shorthand syntax to create OrderedDict…
permissive · top 15,000 on PyPI
jsonasobj2Converts JSON data into Python objects with…
permissive · top 15,000 on PyPI
querystring-parserParses URL query strings and POST data into…
permissive · top 5,000 on PyPI