Skip to main content

SigmaEpsilon.DeepDict - A lightweight Python library for nested dictionaries

CircleCI codecov Codacy Badge Documentation Status License PyPI - Downloads PyPI - Version PyPI - Python Version Code style: black Static Badge

sigmaepsilon.deepdict is a lightweight Python library designed to handle nested dictionaries more easily, especially in cases where dictionaries are created dynamically. Its key feature is the DeepDict class, which extends the regular dict to support nested layouts. It allows easy manipulation of deeply nested structures, array-like indexing, and automatic creation of deep dictionary levels without manually defining all parent keys. It is particularly useful in scenarios involving hierarchical data. The library also supports printing dictionaries as trees.

The first implementation of the DeepDict class was based on this StackOverflow thread.

Key Features

  • Nested Layout Support: DeepDict allows for seamless manipulation of deeply nested structures, enabling array-like indexing and automatic creation of nested dictionary levels without the need to manually define all parent keys.

  • Parent-Child Awareness: Each sub-dictionary within a DeepDict is aware of its parent container, providing attributes like key, address, and parent.key to facilitate navigation and management of the nested structure.

  • Tree Representation: With the optional installation of the asciitree library, DeepDict can print dictionaries as trees, offering a visual representation of the nested data.

Example Usage

from sigmaepsilon.deepdict import DeepDict

# Creating a DeepDict instance
data = DeepDict()
data["a", 0, "b", 1, 5] = 10

# Accessing attributes
print(data["a", 0, "b"].key)       # Output: 'b'
print(data["a", 0, "b"].address)   # Output: ['a', 0, 'b']
print(data["a", 0, "b"].parent.key) # Output: 0

See the documentation for more examples and explanation on behaviour.

Documentation

The documentation is built with Sphinx using the PyData Sphinx Theme and hosted on ReadTheDocs.

Installation

For installation instructions, please refer to the documentation.

License

This package is licensed under the MIT license.

Metadata

Release files for sigmaepsilon.deepdict 3.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sigmaepsilon.deepdict 3.1.0
File Size Uploaded Provenance Actions
sigmaepsilon_deepdict-3.1.0.tar.gz 10.8 kB Without provenance Details for sigmaepsilon_deepdict-3.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sigmaepsilon.deepdict 3.1.0
File Interpreter ABI Platform Actions
sigmaepsilon_deepdict-3.1.0-py3-none-any.whl Python 3 none any Details for sigmaepsilon_deepdict-3.1.0-py3-none-any.whl

Total release size: 22.1 kB

Release files / sigmaepsilon_deepdict-3.1.0.tar.gz

Download URL sigmaepsilon_deepdict-3.1.0.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ca9f1381b38d319fdd4b9608f66381fe259a73407fc1dff4834eb2576ebb5b93
BLAKE2b-256 checksum
How to use checksums
c6293c971ce5db1cd608ff5952e1261d9214bb059c9757bc0ed49478c554dc0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / sigmaepsilon_deepdict-3.1.0-py3-none-any.whl

Download URL sigmaepsilon_deepdict-3.1.0-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38662e766c05623880996052ee3a8370b9eb91a43ea63f990f17f38897867b9f
BLAKE2b-256 checksum
How to use checksums
af032fd074782a9e865757dfb6e7db001109ad06a6a7be90caaabdf0e0168ab3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for sigmaepsilon.deepdict 3.1.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page