Settings management, pluggable secrets, and run-scoped logging for Python applications.
Project description
Konfig
Settings management, pluggable secrets, and run-scoped logging for Python applications.
Konfig provides three foundational capabilities every Python application needs, with an optional lightweight app lifecycle context manager that ties them together. It is a clean-sheet replacement for dtPyAppFramework.
Features
- Layered settings with system/user/env/runtime precedence and persistent writes
- Pluggable secrets with OS keyring, AES-encrypted file, and AWS Secrets Manager backends
- Run-scoped logging with historical retention, structured JSON mode, and stdio-safe output
- Platform-aware defaults for config, data, and log directories (macOS, Linux, Windows)
- Optional app lifecycle via a sync/async context manager — no inheritance required
- Python 3.10+
Installation
pip install konfig
For AWS Secrets Manager support:
pip install konfig[aws]
Quick Start
from konfig import AppContext
with AppContext(
name="My Application",
version="1.0.0",
config_file="config.yaml",
env_prefix="MYAPP",
) as ctx:
host = ctx.settings.get("database.host", "localhost")
api_key = ctx.secrets.get("api_key")
ctx.logger.info("Starting with host=%s", host)
For async applications:
async with AppContext(name="My Server", version="2.0.0") as ctx:
await run_server(ctx.settings)
Each subsystem (Settings, Secrets, LogManager) can also be used independently. See the full documentation in the docs/ directory:
- Settings Guide
- Secrets Guide
- Logging Guide
- AppContext Guide
- Platform Paths
- Configuration Reference
- API Reference
Samples
Working examples are provided in the samples/ directory:
| File | Description |
|---|---|
basic_settings.py |
Config files, defaults, env vars, overrides |
secrets_usage.py |
Store, retrieve, and delete secrets |
logging_demo.py |
Run-scoped logging with retention |
app_context.py |
Full lifecycle with all subsystems |
async_app.py |
Async context manager usage |
custom_backend.py |
Implementing a custom SecretBackend |
Development
pip install -e ".[dev]"
pytest
pytest --cov=konfig
mypy src/konfig
black src/ tests/
isort src/ tests/
License
MIT License. See LICENSE for details.
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 cognisn_konfig-0.1.1.tar.gz.
File metadata
- Download URL: cognisn_konfig-0.1.1.tar.gz
- Upload date:
- Size: 39.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b021cd38adf6518034a3e7da611585a645cce32c39af08b8b603610b2a11eca
|
|
| MD5 |
826d122c0c4ce62d47e5f04e5b808bc0
|
|
| BLAKE2b-256 |
e6c2236b8e8dd940b42b75dd69ec5197fa20f9da6dacf0b7b6adc1638da2088f
|
Provenance
The following attestation bundles were made for cognisn_konfig-0.1.1.tar.gz:
Publisher:
publish.yml on Cognisn/konfig
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cognisn_konfig-0.1.1.tar.gz -
Subject digest:
5b021cd38adf6518034a3e7da611585a645cce32c39af08b8b603610b2a11eca - Sigstore transparency entry: 1275968056
- Sigstore integration time:
-
Permalink:
Cognisn/konfig@3fa667e0cba904c923617ca433a1582c7fe12a5f -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Cognisn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3fa667e0cba904c923617ca433a1582c7fe12a5f -
Trigger Event:
release
-
Statement type:
File details
Details for the file cognisn_konfig-0.1.1-py3-none-any.whl.
File metadata
- Download URL: cognisn_konfig-0.1.1-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11fdadc12e802057bb5f92bc8b5df1e68c29943afa7b7f100ab4a85156a7e308
|
|
| MD5 |
abf65f4286a2dd8231032ff781482eba
|
|
| BLAKE2b-256 |
8c4748575b0ffa24e4b6a7545405273b84e96f669325bb93377a87b3277e341c
|
Provenance
The following attestation bundles were made for cognisn_konfig-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on Cognisn/konfig
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cognisn_konfig-0.1.1-py3-none-any.whl -
Subject digest:
11fdadc12e802057bb5f92bc8b5df1e68c29943afa7b7f100ab4a85156a7e308 - Sigstore transparency entry: 1275968074
- Sigstore integration time:
-
Permalink:
Cognisn/konfig@3fa667e0cba904c923617ca433a1582c7fe12a5f -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Cognisn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3fa667e0cba904c923617ca433a1582c7fe12a5f -
Trigger Event:
release
-
Statement type: