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 details)
Built Distribution
File details
Details for the file bc_configs-0.1.7.tar.gz
.
File metadata
- Download URL: bc_configs-0.1.7.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.0 Darwin/23.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f361244d85e271b2fdf1433ffd6aef900bb9e4016b61ce4c97a40c4a2cb0bada |
|
MD5 | 14871ce2b04c81d8b2a30c5c95e72875 |
|
BLAKE2b-256 | a902a1ebe7c4e3c6031c6a038f21703cfce85bec84705302d93d8fc310d57d75 |
File details
Details for the file bc_configs-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: bc_configs-0.1.7-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.0 Darwin/23.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae9d0a6ad57ddff7eaec53f2058ad61c543102ae65b8b7f6e12a3b3020136210 |
|
MD5 | ad2d8d8764954cab657ca8d630a6dbcf |
|
BLAKE2b-256 | 5547ef0618d5afb2a68f4371c14ecde0d90dfdfa2907c642374ebbcd771434a0 |