deflate-dict
Package to deflate and inflate dictionaries.
What it is and what it does
Deflate Dict is a utility for converting nested dictionaries into flat, single-level dictionaries and back again. It works by traversing nested structures—dicts and lists—and creating flattened keys that encode the path to each leaf value using a configurable separator. The inverse operation, inflate, reconstructs the original nested structure from the flattened keys. This is useful when you need to serialize, store, or transmit nested data in a format that expects flat key-value pairs, or when you want to apply operations uniformly across all leaf values without recursion.
The package has no runtime dependencies and is straightforward to install. It supports optional type encoding to preserve the original types of keys during the flatten-unflatten cycle. Maintenance is dormant, with the last update in October 2024, so bug fixes or feature additions are unlikely without community contribution.
Use it for:
- Convert nested configuration dictionaries to flat environment variables or flat config files for deployment.
- Serialize nested API responses or database records into a single-level format for storage or transmission.
- Flatten hierarchical data structures for machine learning feature engineering or data analysis pipelines.
- Create lookup tables or caches from nested data where keys encode the full path to each value.
- Debug or inspect deeply nested dictionaries by viewing all leaf values with their full paths at once.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Flattens nested dictionaries into single-level key-value pairs using a separator, and reconstructs them back to their original nested structure.
Yes, if you have a specific need to flatten and unflatten nested dictionaries and accept that the package is not actively maintained. The code is simple, has no dependencies, and carries no security vulnerabilities. MIT licensing is unrestrictive. However, dormant maintenance means no bug fixes or Python version updates are forthcoming—use it only for stable, self-contained use cases where you can own any future fixes.
Install
deflate-dict on PyPI
pip
pip install deflate-dictuv
uv add deflate-dictpoetry
poetry add deflate-dictInstalling deflate-dict
Before you install
High install friction with no compiled dependencies. Maintenance is dormant—last commit was 2024-10-26, but the package has not been updated in 657 days and shows minimal community engagement (2 stars). Installation will succeed, but ongoing support is uncertain.
License in practice
MIT license is permissive and imposes no restrictions on use, modification, or redistribution in proprietary or open-source projects.
Quickstart
pip install deflate_dict
from deflate_dict import deflate, inflate
D = {"a": [{"b": (0, 1, 2)}, {"c": [1, 2, 3]}]}
flat = deflate(D, sep="_")
restored = inflate(flat, sep="_")
Verify before relying
- Whether type_encode_key parameter correctly preserves and restores all Python types during round-trip deflate/inflate cycles.
- Performance characteristics with very large or deeply nested dictionaries.
- Compatibility with Python versions beyond the unspecified support range.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | dormant — 657 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 86,606/month — #13,847 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: deflate_dict-1.2.2.tar.gz
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
flatdictFlattens nested dictionaries into single-level…
permissive · top 5,000 on PyPI
flatten-jsonConverts nested JSON objects into flat…
permissive · top 5,000 on PyPI
json-flattenConverts nested JSON objects into flat…
permissive · top 15,000 on PyPI
flatten-dictConverts nested dictionaries into flat…
permissive · top 5,000 on PyPI
json-flattenerConverts nested JSON/YAML objects into flat…
permissive · top 15,000 on PyPI
inflate64Provides Deflater and Inflater classes to…
copyleft · top 5,000 on PyPI
dm-treeProvides utilities for working with nested data…
permissive · top 5,000 on PyPI
deflateThin Python wrapper around libdeflate for fast…
permissive · top 15,000 on PyPI
json-tools-rsFlattens and unflattens nested JSON structures…
permissive · top 15,000 on PyPI
json-normalizeRecursively flattens nested JSON-like…
permissive · top 15,000 on PyPI