AutoDict
Dictionary that automatically adds children dictionaries as necessary. Including a json based serialization and deserialization.
Environment
List of dependencies for package to run.
Required
- None
Optional
- None
Installation / Build / Deployment
Install module
> python -m pip install autodict
For development, install as a link to repository such that code changes are used.
> python -m pip install -e .
Usage
>>> from autodict import AutoDict, JSONAutoDict
>>>
>>> d = AutoDict()
>>> print(d)
{}
>>> d["level0"]["level1"]["level2"]["level3"] = "value"
>>> print(d)
{'level0': {'level1': {'level2': {'level3': 'value'}}}}
>>>
>>> with JSONAutoDict("autodict.json") as j:
... j["level0"]["level1"]["level2"]["level3"] = "value"
...
>>> print(open("autodict.json").read())
{
"__type__": "AutoDict",
"level0": {
"__type__": "AutoDict",
"level1": {
"__type__": "AutoDict",
"level2": {
"__type__": "AutoDict",
"level3": "value"
}
}
}
}
>>> with JSONAutoDict("autodict.json") as j:
... j["level0"]["key"] = "another value"
...
>>> print(open("autodict.json").read())
{
"__type__": "AutoDict",
"level0": {
"__type__": "AutoDict",
"level1": {
"__type__": "AutoDict",
"level2": {
"__type__": "AutoDict",
"level3": "value"
}
},
"key": "another value"
}
}
Running Tests
To run the automated tests, execute unittest discover:
> python -m unittest discover tests -v
To run the automated tests with coverage, execute coverage run:
> python -m coverage run
> python -m coverage report
Development
Code development of this project adheres to Google Python Guide
Styling
Use yapf to format files, based on Google's guide with the exception of indents being 2 spaces.
Versioning
Versioning of this projects adheres to Semantic Versioning and is implemented using git tags.
Metadata
Release files for AutoDict 2.0.0
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 |
|---|---|---|---|---|
| AutoDict-2.0.0.tar.gz | 11.2 kB | Without provenance | Details for AutoDict-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| AutoDict-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for AutoDict-2.0.0-py3-none-any.whl |
Total release size: 30.5 kB
Release files / AutoDict-2.0.0.tar.gz
| Download URL | AutoDict-2.0.0.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94c37f5ffa3cbf2df08b19b90b17ec4a1ea0df7bc4f57e7eb5c0f133fab64190
|
|
BLAKE2b-256 checksum How to use checksums |
50c6149919b202f0f05b16848dbb92bafa9e2a37dee51059c674370aec2f5131
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / AutoDict-2.0.0-py3-none-any.whl
| Download URL | AutoDict-2.0.0-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96033dfa57baee7bf1ce4d39ad706623c59c98b51a9c7f14a7c59f18133c7ad2
|
|
BLAKE2b-256 checksum How to use checksums |
6bf9455077054e9ff4027891e6a2a53d177c1d97b7745772342f5ed2c7d40e8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for AutoDict 2.0.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.