praline-config
Python app configuration library to instantiate Python objects from various configuration inputs.
Purpose
praline-config endeavours to make gathering configuration inputs from various
sources as low-friction and straightforward as possible.
Getting Started
Installation
pip install praline-config
Example Usage
Using praline.config has a few steps...
- Write configuration data in a supported format(yaml, toml, dotenv, etc..)
- Define a dataclass to hold your configuration data
- Instantiate the configuration object
Example YAML Configuration
server_address: "www.example.com"
threads: 4
Example Program
#!/usr/bin/env python3
from dataclasses import dataclass
from praline.config import AppConfigBase
@dataclass
class AppConfig(AppConfigBase):
server_address: str = None
threads: int = None
def main():
app_config: AppConfig = AppConfig.load(config="example.yaml")
print(f"Server: {app_config.server_address}")
print(f"Threads: {app_config.threads}")
if __name__ == "__main__":
exit(main())
Output
Server: www.example.com
Threads: 4
Supported Configuration Sources
praline-config leverages the python-configuration package to handle the raw
configuration data, so any format it supports is supported. Additionally,
praline-config can handle importing dotenv formatted files and binding
environment variable values to fields in your configuration class. Finally, it
can also incorporate values gathered from the CLI or similar through a
dictionary.
See the documentation for python-configuration for the complete list of supported formats.
Dependencies
python-configuration
A library to load configuration parameters hierarchically from multiple sources and formats
python-configuration is an excellent library designed to interface with many
different sources commonly used to store configuration data. We use it here as
an adaptor for the various configuration sources being used as inputs.
python-dotenv
Python-dotenv reads key-value pairs from a .env file and can set them as environment variables. It helps in the development of applications following the 12-factor principles.
Used to load .env formatted files.
Metadata
Release files for praline-config 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| praline_config-0.1.3.tar.gz | 9.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| praline_config-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.1 kB
Release files / praline_config-0.1.3.tar.gz
| Download URL | praline_config-0.1.3.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
84e609d054534dfd045a98b3d58431ef10e0b41f2420ec653299ff3b2e082f9c
|
|
BLAKE2b-256 checksum How to use checksums |
8633048b2f6484b4ffb550a34a3adaba3ead59e07cd5eaec7cf6115b812d948b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Release files / praline_config-0.1.3-py3-none-any.whl
| Download URL | praline_config-0.1.3-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
927f6d5ef2936dd9b4c31f010c49daff8210667cb1cba5cf8f90fef12a8373a8
|
|
BLAKE2b-256 checksum How to use checksums |
464ef5b07ca4a45447ba05781b070e4a4d468b837314f880cd5111cdc49ae7d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|