PyMicroConf
A lightweight, type-safe TOML configuration loader with environment variable overrides for Python applications.
PyMicroConf provides a simple way to manage application configuration using TOML files while supporting environment variable overrides. It uses Python dataclasses and type annotations for type safety and automatic validation.
Features
- Lightweight: Minimal dependencies, uses only Python standard library
- Type-safe: Full type checking with dataclasses and type annotations
- Environment Override: Environment variables take precedence over config files
- Nested Configuration: Support for nested configuration structures
- Automatic Validation: Built-in validation for required fields and types
- Easy to Use: Intuitive API with minimal boilerplate
Installation
pip install pymicroconf
Usage
Define a configuration class using dataclasses and type annotations:
from pathlib import Path
from typing import Annotated
from pymicroconf import ConfigHandler, ConfigField, BaseConfig
class AppConfig(BaseConfig):
api_key: Annotated[str, ConfigField("API_KEY", required=True)]
database_url: Annotated[str, ConfigField("DATABASE_URL", required=True)]
debug: Annotated[str, ConfigField("DEBUG", default=False)]
config = Config(Path("config.toml"), AppConfig).load_config()
Access configuration values:
print(config.api_key)
print(config.database_url)
print(config.debug)
Metadata
Release files for pymicroconf 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pymicroconf-0.1.0.tar.gz | 21.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pymicroconf-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.8 kB
Release files / pymicroconf-0.1.0.tar.gz
| Download URL | pymicroconf-0.1.0.tar.gz |
|---|---|
| Size | 21.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98e79fa0f045a96dd5a686ffae96037980460231f063b2e980d02e4e99cdabcd
|
|
BLAKE2b-256 checksum How to use checksums |
4b055ab7b62bbf7bd4bb3dbed152a520a223548a83a05f9fffff0eace637724a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pymicroconf-0.1.0-py3-none-any.whl
| Download URL | pymicroconf-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d4e5486145008cad0b0868b6221088c1c1d665f38c4672f25a458ba4b9013bf
|
|
BLAKE2b-256 checksum How to use checksums |
663e4a93ea39e6d827c85e8e5e351f1d8d484c3e1c318cd19c23b0d63879887f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|