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.2.8.tar.gz
(5.0 kB
view hashes)
Built Distribution
Close
Hashes for envclasses-0.2.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d337de28936a2f96795c72f468e3ebd52f3398371c1b22a5a05a43a1707d5ca6 |
|
MD5 | ebed6b3074252d5f472f51b8bb9ed02c |
|
BLAKE2b-256 | 4e69aadda1ebc7247647381508a37e290cd053998a0e7e64927a988b02156e44 |