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.1.tar.gz
(5.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file envclasses-0.3.1.tar.gz.
File metadata
- Download URL: envclasses-0.3.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.15 Darwin/21.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13f9449e97a94b4ec6052edcd990aeebd0e58b63f5b6188200e82f4b3e5f72ef
|
|
| MD5 |
0d9c367622ded0c50bf1dc9fd8dff1a1
|
|
| BLAKE2b-256 |
9caa911b382870649ec2fe3c61ee6906700cfdeae5e9c278343f4b9e1e809e0e
|
File details
Details for the file envclasses-0.3.1-py3-none-any.whl.
File metadata
- Download URL: envclasses-0.3.1-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.15 Darwin/21.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16026211b60a37a7c4e3702ad150a3584a33dc7bff5273e9b640ac739602c0b7
|
|
| MD5 |
fc6352e120cd0026c2672716de0b49b1
|
|
| BLAKE2b-256 |
0d31c8c5dd38b72eded40df850c6f1a5aa6fec19b9fe1cd209b5385b0a559e15
|