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, load_env
from dataclasses import dataclass
@envclass
@dataclass
class Foo:
v: int
foo = Foo(v=10)
load_env(foo, prefix='foo')
print(foo)
Run the script
$ python foo.py
Foo(v=10)
Run with environment variable
$ FOO_V=100 python foo.py
Foo(v=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.3.0.tar.gz
(5.2 kB
view hashes)
Built Distribution
Close
Hashes for envclasses-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a04ac3fbd43d0560babbb895279aadeb017c47bbbb70ac521251559cc4c6dd6 |
|
MD5 | b97d486a25cd93507d8f88408ca35450 |
|
BLAKE2b-256 | 15ab32e05cdae9c9751d9fe685883b9fa03e92fad97aaeb5b8e1a8f5453ab477 |