env_var_config
This project allows you to describe the configuration of your application as a typing.NamedTuple, like so:
import typing
class MyAppConfig(typing.NamedTuple):
some_string: str
some_int: int
some_float: float
some_bool: bool = True
Then, gather the configuration from the environment variables:
import env_var_config
config = env_var_config.gather_config_for_class(MyAppConfig)
The code will look for variables that are called like the fields of the tuple, but uppercase.
As you might have noticed, you can set default values on the fields. If the fields with defaults are not found in the environment, they’re set to their default value (which is quite unsurprising). If a value without a default is missing, though, an error will be raised. That is, unless you set allow_empty option to True in the call to gather_config_for_class. Then all missing values will be initialized with the default value for their type, such as an empty string for str, 0 for int, etc.
Installation
pip install env_var_config
Metadata
Release files for env-var-config 0.1.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 |
|---|---|---|---|---|
| env_var_config-0.1.0.tar.gz | 3.7 kB | Without provenance | Details for env_var_config-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| env_var_config-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for env_var_config-0.1.0-py3-none-any.whl |
Total release size: 7.2 kB
Release files / env_var_config-0.1.0.tar.gz
| Download URL | env_var_config-0.1.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a88b095f28364ec0d5c692b7209f8eb2ef77b0eceff7226bbbb9c25b2256fa2d
|
|
BLAKE2b-256 checksum How to use checksums |
2223597166cb872f0bb71a340e2a369c650ccd74de500a3f0dac289efba72d2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / env_var_config-0.1.0-py3-none-any.whl
| Download URL | env_var_config-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88a6c2a7a6e22f93d8edc5349c56bb773d1a3c44296c09208843b680997f8c97
|
|
BLAKE2b-256 checksum How to use checksums |
1e09e786589caa8887d12992336c214dc06d0b13a822a631aea79dd83c92502b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for env-var-config 0.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.