dict-like grouping of environment variables :sparkles:
---
Imagine you have this:
```
COUNTRIES_GB_NAME="United Kingdom"
COUNTRIES_GB_TLD=.uk
COUNTRIES_HK_NAME=China
COUNTRIES_HK_TLD=.cn
```
and with a simple call you can have all of this:
```python
>>> import os
>>> import dictenvy
>>> import pprint
>>> env = dictenvy.dictate(os.environ, depth=2)
>>> pprint.pprint(env)
{'countries': {'gb': {'name': 'United Kingdom', 'tld': '.uk'},
'hk': {'name': 'China', 'tld': '.cn'}}}
```
`depth` is how you regulate the depth of the returned dictionary.
<details><summary>Couple gotchas</summary>
### #1
Sometimes you may encounter the following situation:
```
TERM_PROGRAM=Apple_Terminal
TERM=xterm-256color
```
In which case, the return value would still be a dict, but `TERM` value would have an empty key like so:
```python
>>> import dictenvy
>>> import pprint
>>> env = dictenvy.dictate({'TERM': 'xterm-256color', 'TERM_PROGRAM': 'Apple_Terminal'}, depth=1))
>>> pprint.pprint(env)
{'term': {'': 'xterm-256color', 'program': 'Apple_Terminal'}}
```
### #2
Variables that start with an underscore will be left alone.
</details>
## Installation
Use pip:
```shell
$ pip install dict-envy
```
## License
MIT
Metadata
Release files for dict-envy 0.2.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 |
|---|---|---|---|---|
| dict-envy-0.2.0.tar.gz | 2.5 kB | Without provenance | Details for dict-envy-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dict_envy-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for dict_envy-0.2.0-py3-none-any.whl |
Total release size: 5.3 kB
Release files / dict-envy-0.2.0.tar.gz
| Download URL | dict-envy-0.2.0.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e7ad15f380a8cb6ffa36384cd4cdfab70b50fd3a515aeb0bef32bdde0b25193
|
|
BLAKE2b-256 checksum How to use checksums |
9f8b3a42fc2e7302e1512b16a29b649d0adbbdcb13f281517c7249de49cc6bc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / dict_envy-0.2.0-py3-none-any.whl
| Download URL | dict_envy-0.2.0-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7fceff87679a806f13952d56fdbc1bb197c850af4591c19b3643f8c85eb34344
|
|
BLAKE2b-256 checksum How to use checksums |
37198fd01c3cfadb46a2c3ab308143a3e77d47199d96e5858295d88f71afdd02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for dict-envy 0.2.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.