Concoction
Concoction is a simple configuration injection library that allows you to easily inject configuration values into your
Python applications. It supports both pydantic and dataclasses for defining configuration models. Unlike traditional
configuration management tools, Concoction does not parse or layer configurations; it only works with a dictionary
object as an input.
Inspiration
Concoction is inspired by the @ConfigurationProperties and @Value annotations from Spring Boot. These annotations
allow for easy injection of configuration properties into Java applications, and Concoction aims to provide a similar
experience for Python developers.
Key Features
- Flexibility with Plain Dictionaries: Simple and flexible configuration management using plain dictionaries.
- Injecting Whole Configuration Blocks: Inject entire configuration blocks for modular and decoupled settings.
- Injecting Individual Fields: Granular control with the ability to inject specific configuration fields.
- Merging Parent Configurations: Option to bind inherited configuration fields to parent configuration block
Installation
To install Concoction, run the following command:
pip install concoction
Usage
Here is an example of config.yaml file:
app:
service:
host: 0.0.0.0
port: 8000
and injecting service block into our config
import yaml # pip install pyyaml
from pydantic import BaseModel
from concoction import Configuration, set_global_config
# define config with injection
@Configuration("app.service")
class ServiceConfig(BaseModel):
host: str
port: int
# Load configuration from a YAML file
with open("config.yaml") as f:
config = yaml.safe_load(f)
set_global_config(config)
# Create an instance of the configuration model
app_config = ServiceConfig()
or field-wise
from concoction.values.pydantic import Value
class ServiceConfig(BaseModel):
host: str = Value("app.service.host")
port: int = Value("app.service.port")
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
Metadata
Release files for concoction 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| concoction-0.1.4.tar.gz | 3.8 kB | Without provenance | Details for concoction-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| concoction-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for concoction-0.1.4-py3-none-any.whl |
Total release size: 8.9 kB
Release files / concoction-0.1.4.tar.gz
| Download URL | concoction-0.1.4.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9eabddefa069bbfeb2e605f509d741315c4f1ba1a4064e56eaaf3dbfcfda95a
|
|
BLAKE2b-256 checksum How to use checksums |
f4206429967141be0c63ad6cc063179235d40d23f859569c6bed0eea04098108
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.1 Linux/6.8.0-1021-azure
|
Release files / concoction-0.1.4-py3-none-any.whl
| Download URL | concoction-0.1.4-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9193120d631ad88ff73916eb30e91179c61ae089b674c9ecef37366aa1fd4b7e
|
|
BLAKE2b-256 checksum How to use checksums |
78f798942731ccf471c8b8833a0cbb4d2503bf814da81d0b031b073d989ace77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.1 Linux/6.8.0-1021-azure
|
Security for concoction 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.