nestify
nestify is a tiny utility that transforms flat dictionaries with path-like keys into proper nested structures.
Think of it as the inverse of flatten:
from nestify import nestify
data = {
"a.b.c": 1,
"a.d": 2,
"x": 3
}
print(nestify(data))
# => {"a": {"b": {"c": 1}, "d": 2}, "x": 3}
✨ Features
-
Custom separators
Not limited to dots (.) — use/,:,::, or any string as a separator. -
Conflict resolution policies
Choose how to handle conflicts:forbid_mixed: strict mode, disallow mixing dict/non-dict (default).merge_dicts: merge dictionaries recursively, warn on key overlaps.overwrite: always overwrite existing values, with a warning.
-
Recursive processing
Values that are dictionaries themselves are also expanded. -
Safe & predictable
Warnings and errors make conflicts explicit, avoiding silent data corruption.
🔧 Usage Examples
Basic Expansion
from nestify import nestify
nestify({"a.b": 1, "a.c": 2})
# => {"a": {"b": 1, "c": 2}}
Custom Separator
from nestify import nestify
nestify({"root/child": 42}, separator="/")
# => {"root": {"child": 42}}
Conflict Resolution
from nestify import nestify
# Overwrite mode
nestify({"a.b": 1, "a.b": 2}, conflict_policy="overwrite")
# => {"a": {"b": 2}}
💡 Why nestify?
When working with configs, JSON/YAML, or flattened exports (from APIs, databases, etc.), you often get keys like "user.profile.name". nestify makes it effortless to convert them into proper nested dicts.
📦 Installation
pip install nestify
🧾 License
MIT License. See LICENSE for details.
Metadata
Release files for nestify 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nestify-0.0.1.tar.gz | 5.7 kB | Without provenance | Details for nestify-0.0.1.tar.gz |
Release files / nestify-0.0.1.tar.gz
| Download URL | nestify-0.0.1.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
34374fdfac0f170a2ee4a8332e09eb263441e3a9ae6e8e2ef0b176b8ce819afd
|
|
BLAKE2b-256 checksum How to use checksums |
77deb45ecb01caf306ef26cffcf56bdc5e7a7e450b881c918c6ace53284926b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Security for nestify 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.