A library to map dataclass and environmental variables
Project description
envclasses
envclasses
is a library to map fields on dataclass object to environment variables.
Installation
pip install envclasses
Usage
Declare a class with dataclass
and envclass
decorators.
from envclasses import envclass
from dataclasses import dataclass
@envclass
@dataclass
class Foo:
v: int
foo = Foo(i=10)
load_env(foo, prefix='foo')
print(foo)
Run the script
$ python foo.py
Foo(i=10)
Run with environment variable
$ FOO_V=100 python foo.py
Foo(i=100)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
envclasses-0.2.6.tar.gz
(5.4 kB
view hashes)
Built Distribution
Close
Hashes for envclasses-0.2.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef32b6ab52afcc13772d0aec36ba2f5dd35e2269c0eae0aa5d9223fe75192ed9 |
|
MD5 | e1e2eb9d4c8e5eeb60fe0452ff96c9a1 |
|
BLAKE2b-256 | ffc3869a4acec7977fb3ad0a02163a94ead7302c478bd21b72e60b90ac091882 |