Skip to main content

Configuration module, that provides a way to manage configs structure, validation and casting to type inside your code. Based on pedantic models. Additionally it can automatically getting config from environment variables, .env, HashiCorp Vault, etc.

Project description

bc-config

Make configuring your application easier.

Installing

pip install bc-configs

Make your custom config class

import os
from bc_configs import BaseConfig

class MyConfig(BaseConfig):
    some_int: int
    some_string: str
    some_bool: bool

my_config = MyConfig()  # type: ignore[call-arg]

assert int(os.getenv("MY_SOME_INT")) == my_config.some_int  # True
assert os.getenv("MY_SOME_STRING") == my_config.some_string  # True
assert bool(os.getenv("MY_SOME_BOOL")) == my_config.some_bool  # True

The name of the environment variable is formed based on the names of the class and field.

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

bc_configs-0.1.7.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

bc_configs-0.1.7-py3-none-any.whl (8.0 kB view hashes)

Uploaded Python 3

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