envclasses is a library to map fields on dataclass object to environment 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.7.tar.gz
(5.0 kB
view hashes)
Built Distribution
Close
Hashes for envclasses-0.2.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 169e8c9ef214abef7ed210e893360259c444302be9e876bb4802abc6221eb894 |
|
MD5 | 4824a4ba4e8534b224584d5484b0e546 |
|
BLAKE2b-256 | 6a3ae6ebf7f6a2d918a3fbb2cb7e3a0b7689f296da2088c3a9314ebf7a20963d |