Metadata-Version: 2.4
Name: bc-configs
Version: 0.2.2
Summary: 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-URL: Homepage, https://github.com/etagi-esoft/py-bc-configs
Project-URL: Repository, https://github.com/etagi-esoft/py-bc-configs
Author-email: Artem Shirokikh <job@artemetr.ru>, Esoft <it@esoft.tech>
License: MIT
License-File: LICENSE
Keywords: config,dotenv,environment,pydantic
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Environment :: MacOS X
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.13
Requires-Dist: pydantic
Description-Content-Type: text/markdown

# bc-config

![](./docs/source/_static/coverage-badge.svg) ![](./docs/source/_static/unittests-badge.svg) ![](./docs/source/_static/mypy-badge.svg) ![](./docs/source/_static/ruff-badge.svg)

*Make configuring your application easier.*

# Installing

```bash
pip install bc-configs
```

# Make your custom config class

```python
import os
from bc_configs import BaseConfig, define

define()

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.

# Features

- Load environment variables from `.env` files (using `python-dotenv`).
- Load environment variables from YAML files (e.g., `.env.yml` or custom path via `YAML_CONFIG_FILE` environment variable).
- Load secrets from HashiCorp Vault (using `hvac`).
