delegatum
Simple cascading/nested scope/namespace manager
Delegatum walks a list of objects that can represent key/value mappings and returns the first match found for a key.
Supports dictionaries, argparse, configparser, mapping functions
Most dictionary-like objects should work as well
Python json and yaml parsers return dictionaries, and so are supported
Examples
The following example searches, in order: command line arguments, a config file, a json string, a yaml string, and the output of a function.
import delegatum
import json
import yaml # Requires external package PyYAML
j = json.loads('{"verbose": true, "output": "file.txt"}')
y = yaml.safe_load(some_yaml_string)
some_f = lambda x: x * x
delegatus = delegatum.Delegatum([cmdline, configfile, j, y, some_f])
print(delegatus['verbose'])
print(delegatus['garbage'])
Attributes
- defaultobject
Default value to return if no lookup succeeds
Raises
- DelegatumError
General library error; should only occur if misconfigured
- DelegatumMissError
Used internally for flow control
See Also
Standard library:
argparse
configparser
json
tomllib
External modules:
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Metadata
Release files for delegatum 1.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 |
|---|---|---|---|---|
| delegatum-1.0.0.tar.gz | 11.1 kB | Without provenance | Details for delegatum-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| delegatum-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for delegatum-1.0.0-py3-none-any.whl |
Total release size: 14.2 kB
Release files / delegatum-1.0.0.tar.gz
| Download URL | delegatum-1.0.0.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8367155ff3df22adbf00e54a23df2d7856dfe6ce5dba043fb04d3ed6913a1e7
|
|
BLAKE2b-256 checksum How to use checksums |
3066123bf7e6dbce7bcd23980c1c17e07f35533c0b8afd9f0631d88301044a56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Release files / delegatum-1.0.0-py3-none-any.whl
| Download URL | delegatum-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
707b430499ac311e253199c282ab87cdea33872f45786fb71d908c529e29aa5d
|
|
BLAKE2b-256 checksum How to use checksums |
b02207bb13a61cf9d73d30cec71115ca1d8ff5bdd245a11005e72fa80ff2a71a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Security for delegatum 1.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.