# **SigmaEpsilon.DeepDict** - A lightweight Python library for nested dictionaries
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/sigma-epsilon/sigmaepsilon.deepdict/tree/main.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/sigma-epsilon/sigmaepsilon.deepdict/tree/main)
[![codecov](https://codecov.io/gh/sigma-epsilon/sigmaepsilon.deepdict/graph/badge.svg?token=7JKJ3HHSX3)](https://codecov.io/gh/sigma-epsilon/sigmaepsilon.deepdict)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/077f95d06b9d4ee88395d5c088e4496a)](https://app.codacy.com/gh/sigma-epsilon/sigmaepsilon.deepdict/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[![Documentation Status](https://readthedocs.org/projects/sigmaepsilondeepdict/badge/?version=latest)](https://sigmaepsilondeepdict.readthedocs.io/en/latest/?badge=latest)
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/sigmaepsilon.deepdict)](https://pypi.org/project/sigmaepsilon.deepdict)
[![PyPI - Version](https://img.shields.io/pypi/v/sigmaepsilon.deepdict)](https://pypi.org/project/sigmaepsilon.deepdict)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sigmaepsilon.deepdict)](https://www.python.org)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Static Badge](https://img.shields.io/badge/versioning-semver-orange)](https://semver.org/)
`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](http://stackoverflow.com/a/6190500/562769) 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
```python
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](https://sigmaepsilondeepdict.readthedocs.io/en/latest/) is built with [Sphinx](https://www.sphinx-doc.org/en/master/) using the [PyData Sphinx Theme](https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html) and hosted on [ReadTheDocs](https://readthedocs.org/).
## **Installation**
For installation instructions, please refer to the [documentation](https://sigmaepsilondeepdict.readthedocs.io/en/latest/).
## **License**
This package is licensed under the [MIT license](LICENSE.txt).
Raw data
{
"_id": null,
"home_page": "https://github.com/sigma-epsilon/sigmaepsilon.deepdict",
"name": "sigmaepsilon.deepdict",
"maintainer": "Bence Balogh",
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": "bencebalogh@sigmaepsilon.com",
"keywords": "data structures, dictionary, Python, tree",
"author": "Bence Balogh",
"author_email": "bencebalogh@sigmaepsilon.com",
"download_url": "https://files.pythonhosted.org/packages/ae/9f/4718923bdf12b232f52e714f8f3ee8d407da7617b87c69936aeb1d18ba2a/sigmaepsilon_deepdict-3.0.1.tar.gz",
"platform": null,
"description": "# **SigmaEpsilon.DeepDict** - A lightweight Python library for nested dictionaries\n\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/sigma-epsilon/sigmaepsilon.deepdict/tree/main.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/sigma-epsilon/sigmaepsilon.deepdict/tree/main)\n[![codecov](https://codecov.io/gh/sigma-epsilon/sigmaepsilon.deepdict/graph/badge.svg?token=7JKJ3HHSX3)](https://codecov.io/gh/sigma-epsilon/sigmaepsilon.deepdict)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/077f95d06b9d4ee88395d5c088e4496a)](https://app.codacy.com/gh/sigma-epsilon/sigmaepsilon.deepdict/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)\n[![Documentation Status](https://readthedocs.org/projects/sigmaepsilondeepdict/badge/?version=latest)](https://sigmaepsilondeepdict.readthedocs.io/en/latest/?badge=latest)\n[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/sigmaepsilon.deepdict)](https://pypi.org/project/sigmaepsilon.deepdict)\n[![PyPI - Version](https://img.shields.io/pypi/v/sigmaepsilon.deepdict)](https://pypi.org/project/sigmaepsilon.deepdict)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sigmaepsilon.deepdict)](https://www.python.org)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Static Badge](https://img.shields.io/badge/versioning-semver-orange)](https://semver.org/)\n\n`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.\n\nThe first implementation of the `DeepDict` class was based on [this](http://stackoverflow.com/a/6190500/562769) StackOverflow thread.\n\n## Key Features\n\n- **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.\n\n- **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.\n\n- **Tree Representation**: With the optional installation of the asciitree library, DeepDict can print dictionaries as trees, offering a visual representation of the nested data.\n\n## Example Usage\n\n```python\nfrom sigmaepsilon.deepdict import DeepDict\n\n# Creating a DeepDict instance\ndata = DeepDict()\ndata[\"a\", 0, \"b\", 1, 5] = 10\n\n# Accessing attributes\nprint(data[\"a\", 0, \"b\"].key) # Output: 'b'\nprint(data[\"a\", 0, \"b\"].address) # Output: ['a', 0, 'b']\nprint(data[\"a\", 0, \"b\"].parent.key) # Output: 0\n\n```\n\nSee the documentation for more examples and explanation on behaviour.\n\n## **Documentation**\n\nThe [documentation](https://sigmaepsilondeepdict.readthedocs.io/en/latest/) is built with [Sphinx](https://www.sphinx-doc.org/en/master/) using the [PyData Sphinx Theme](https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html) and hosted on [ReadTheDocs](https://readthedocs.org/).\n\n## **Installation**\n\nFor installation instructions, please refer to the [documentation](https://sigmaepsilondeepdict.readthedocs.io/en/latest/).\n\n## **License**\n\nThis package is licensed under the [MIT license](LICENSE.txt).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Common developer utilities for Python projects.",
"version": "3.0.1",
"project_urls": {
"Documentation": "https://sigmaepsilondeepdict.readthedocs.io/en/latest/?badge=latest",
"Homepage": "https://github.com/sigma-epsilon/sigmaepsilon.deepdict",
"Repository": "https://github.com/sigma-epsilon/sigmaepsilon.deepdict"
},
"split_keywords": [
"data structures",
" dictionary",
" python",
" tree"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c4e22e07128b37dda6dca47b84cb25cc1b59fe5a3901983ae48ca780aea6ae5e",
"md5": "fc848ad0d3bcdcfe9b3bf3771bcbe696",
"sha256": "d900af629484decafd8d34d81d47731680c78d9b0f3a26adc1bcd56184b99f32"
},
"downloads": -1,
"filename": "sigmaepsilon_deepdict-3.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fc848ad0d3bcdcfe9b3bf3771bcbe696",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 11297,
"upload_time": "2024-12-08T10:28:05",
"upload_time_iso_8601": "2024-12-08T10:28:05.127687Z",
"url": "https://files.pythonhosted.org/packages/c4/e2/2e07128b37dda6dca47b84cb25cc1b59fe5a3901983ae48ca780aea6ae5e/sigmaepsilon_deepdict-3.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ae9f4718923bdf12b232f52e714f8f3ee8d407da7617b87c69936aeb1d18ba2a",
"md5": "a22abbab3546b502ac137fe70621b869",
"sha256": "8482edc98557cae3a37e762c22372003c21d6241f1a87da33909c45ed22ffdee"
},
"downloads": -1,
"filename": "sigmaepsilon_deepdict-3.0.1.tar.gz",
"has_sig": false,
"md5_digest": "a22abbab3546b502ac137fe70621b869",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 11522,
"upload_time": "2024-12-08T10:28:06",
"upload_time_iso_8601": "2024-12-08T10:28:06.030338Z",
"url": "https://files.pythonhosted.org/packages/ae/9f/4718923bdf12b232f52e714f8f3ee8d407da7617b87c69936aeb1d18ba2a/sigmaepsilon_deepdict-3.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-08 10:28:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sigma-epsilon",
"github_project": "sigmaepsilon.deepdict",
"travis_ci": false,
"coveralls": true,
"github_actions": false,
"circle": true,
"tox": true,
"lcname": "sigmaepsilon.deepdict"
}