skillfed

deflate-dict

Package to deflate and inflate dictionaries.

deflate-dict v1.2.2 86.6K downloads/30d#13,847 on PyPI2
Permissive license MIT DORMANT released

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-dict

uv

uv add deflate-dict

poetry

poetry add deflate-dict

Installing 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

Development Status :: 5 - Production/StableLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3

Tags

flatten nested dictionarydeflate inflate dictnested dict to flatdictionary serializationflatten dict keysnested structure flattening
data-structureserialization

More Utilities packages