Application configuration manager
Project description
qstd-config
A lightweight and flexible configuration management library for Python applications, built on top of Pydantic.
It allows you to load and validate settings from multiple sources
(YAML/JSON files, environment variables, or custom loaders), merge them via strategy,
and supports hot-reload as well as multiprocess-safe sharing.
Key Features
- Chain of loaders: load configuration from multiple sources (files, environment variables, custom loaders).
- Pydantic integration: validate the final config using a
BaseModel. - Flexible merge strategies: deep merge by default, with support for custom strategies.
- ProxyConfig: proxy object with
reload(),setup()methods and model attribute access. - Hot-reload support: update configuration at runtime without restarting the process.
- Multiprocessing storage: share configuration between processes using
multiprocessing.Manager().dict(). - Extensibility: plug in custom loaders, merge strategies, and storages.
Documentation
Install
pip install qstd-config
Quick start
from pydantic import BaseModel
from qstd_config import ConfigManager
class AppConfig(BaseModel):
class DB(BaseModel):
host: str = "localhost"
port: int = 5432
debug: bool = False
db: DB
manager = ConfigManager(
AppConfig,
project_name="My App",
config_paths=["./config.yaml"],
default_config_values={"debug": False},
)
config = manager.load_config_model()
print(config.db.host, config.db.port, config.debug)
Environment variables
The list of supported environment variables is automatically generated based on the structure of the config model.
You can override variable names explicitly via json_schema_extra in Pydantic’s Field. For example:
from pydantic import BaseModel, Field
class AppConfig(BaseModel):
class DB(BaseModel):
host: str = Field("localhost")
port: int = Field(5432, json_schema_extra={'env': 'DATABASE_PORT'})
debug: bool = False
db: DB
Recognized environment variables:
DEBUGDB_HOSTDATABASE_PORT
If project_name="My App" is specified, variables will be prefixed:
MY_APP_DEBUGMY_APP_DB_HOSTMY_APP_DATABASE_PORT
Configuration paths
You can provide configuration file paths from multiple sources. The order below defines the precedence (higher overrides lower):
- CLI argument:
--config=/path/to/config.yaml - Environment variable:
MY_APP_CONFIG=/path1.yaml;/path2.yaml config_pathsargument passed explicitly to the manager
Tests
pytest --cov=qstd_config --cov-report=term-missing
Compatibility
Tested on Python 3.9-3.13.
License
MIT License
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
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 qstd_config-1.0.2.tar.gz.
File metadata
- Download URL: qstd_config-1.0.2.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1d16fd5c23696beb4f5f86710a9ce74f2fe4080a1510400600be020e4ef0392
|
|
| MD5 |
f0acca65042a903d986970544a222884
|
|
| BLAKE2b-256 |
d13fd44353e13f4ed55bc6d37bbb606d9ec9f349bc4a53ae00788ca27bb37ba5
|
Provenance
The following attestation bundles were made for qstd_config-1.0.2.tar.gz:
Publisher:
python-publish.yml on QuisEgoSum/qstd-config
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qstd_config-1.0.2.tar.gz -
Subject digest:
f1d16fd5c23696beb4f5f86710a9ce74f2fe4080a1510400600be020e4ef0392 - Sigstore transparency entry: 924375469
- Sigstore integration time:
-
Permalink:
QuisEgoSum/qstd-config@4b40aa2cd424e85b6e42a32b98057bf53d573c16 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/QuisEgoSum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4b40aa2cd424e85b6e42a32b98057bf53d573c16 -
Trigger Event:
release
-
Statement type:
File details
Details for the file qstd_config-1.0.2-py3-none-any.whl.
File metadata
- Download URL: qstd_config-1.0.2-py3-none-any.whl
- Upload date:
- Size: 26.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e59ef73775918ebf57d00f009ca67546d815338e90cf6f2038b844be4d8906b
|
|
| MD5 |
60c482360de0075f2afa29cfbe75a7e5
|
|
| BLAKE2b-256 |
46584d4379021b302f529e444538c4cf2c59283d5bba6622bda089674a85366e
|
Provenance
The following attestation bundles were made for qstd_config-1.0.2-py3-none-any.whl:
Publisher:
python-publish.yml on QuisEgoSum/qstd-config
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qstd_config-1.0.2-py3-none-any.whl -
Subject digest:
1e59ef73775918ebf57d00f009ca67546d815338e90cf6f2038b844be4d8906b - Sigstore transparency entry: 924375472
- Sigstore integration time:
-
Permalink:
QuisEgoSum/qstd-config@4b40aa2cd424e85b6e42a32b98057bf53d573c16 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/QuisEgoSum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4b40aa2cd424e85b6e42a32b98057bf53d573c16 -
Trigger Event:
release
-
Statement type: