Skip to main content

envclasses is a library to map fields on dataclass object to environment variables

Project description

envclasses

image image Test

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


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)

Uploaded Source

Built Distribution

envclasses-0.3.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

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

Hashes for envclasses-0.3.1.tar.gz
Algorithm Hash digest
SHA256 13f9449e97a94b4ec6052edcd990aeebd0e58b63f5b6188200e82f4b3e5f72ef
MD5 0d9c367622ded0c50bf1dc9fd8dff1a1
BLAKE2b-256 9caa911b382870649ec2fe3c61ee6906700cfdeae5e9c278343f4b9e1e809e0e

See more details on using hashes here.

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

Hashes for envclasses-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 16026211b60a37a7c4e3702ad150a3584a33dc7bff5273e9b640ac739602c0b7
MD5 fc6352e120cd0026c2672716de0b49b1
BLAKE2b-256 0d31c8c5dd38b72eded40df850c6f1a5aa6fec19b9fe1cd209b5385b0a559e15

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page