Helper to merge multiple configuration files into one file.
Project description
blendconf
A powerful CLI tool for merging and converting configuration files across different formats.
Features
- 🔀 Merge multiple config files - Combine configurations from different sources
- 🔄 Format conversion - Convert between JSON, YAML, TOML, and ENV formats
- 📤 Flexible output - Write to file or print to stdout
- 🎯 Simple CLI - Easy to use command-line interface
Supported Formats
- JSON (
.json) - YAML (
.yaml,.yml) - TOML (
.toml) - ENV (
.env)
Installation
We recommend using uv for the best experience, alternative install methods are available here.:
# Install uv (if you haven't already)
curl -LsSf https://astral.sh/uv/install.sh | sh
Then, you can run blendconf directly without installation:
# Run blendconf directly with uvx (no installation needed!)
uvx blendconf --help
Usage
Merge Configuration Files
Merge multiple config files and save the result:
uvx blendconf config1.json config2.json -o merged.json
Merge configs and print to stdout:
uvx blendconf config1.toml config2.toml
The output format is determined by the first input file when printing to stdout, or by the output file extension when using -o.
Convert Between Formats
Convert a JSON file to TOML:
uvx blendconf config.json -o config.toml
Convert YAML to JSON:
uvx blendconf settings.yaml -o settings.json
Print converted file to stdout (uses input file format by default):
uvx blendconf config.json # outputs as JSON
Merge Strategy
You can specify how configs should be merged using the --strategy or -s option:
uvx blendconf base.yaml overrides.yaml -o final.yaml --strategy replace
Available strategies:
replace(default): Later values replace earlier onesappend: Lists are concatenated, dictionaries are merged
Examples
Check out the examples directory for sample configuration files:
# Merge two JSON configs
uvx blendconf examples/config1.json examples/config2.json -o merged.json
# Convert JSON to TOML
uvx blendconf examples/config1.json -o config.toml
# Merge YAML and TOML (prints as YAML)
uvx blendconf examples/settings.yaml examples/overrides.toml
# Merge and convert to different format
uvx blendconf examples/settings.yaml examples/overrides.toml -o final.json
Example: Merging Configs
config1.json:
{
"database": {
"host": "localhost",
"port": 5432
},
"logging": {
"level": "INFO"
}
}
config2.json:
{
"database": {
"host": "production.db.example.com",
"username": "admin"
},
"api": {
"timeout": 30
}
}
Result:
$ uvx blendconf config1.json config2.json
{
"database": {
"host": "production.db.example.com",
"port": 5432,
"username": "admin"
},
"logging": {
"level": "INFO"
},
"api": {
"timeout": 30
}
}
Library Usage
While blendconf is primarily designed as a CLI tool, you can also use it as a Python library:
from pathlib import Path
from blendconf import merge_configs, dump_file, MergeStrategy
# Merge configs
merged = merge_configs(
[Path("config1.json"), Path("config2.json")],
MergeStrategy.REPLACE
)
# Save result
dump_file(merged, Path("output.yaml"), "yaml")
Note: The library currently has dependencies on typer and rich (used by the CLI). If you want to use blendconf as a library-only package without these dependencies, PRs are welcome! 🙏
Development
# Clone the repository
git clone https://github.com/hwmrocker/blendconf.git
cd blendconf
# Install dependencies with uv
uv sync
# Run tests
uv run pytest
# Run the CLI locally
uv run blendconf --help
Contributing
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation
Especially welcome: PRs to make the library usable without CLI dependencies!
License
See LICENSE file 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 blendconf-1.0.1.tar.gz.
File metadata
- Download URL: blendconf-1.0.1.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45f6d3797af92c1df808b74fe4987b51d46ccc01a8402c640a07ecbe1ff50263
|
|
| MD5 |
a37396deb78f988825461f9bfe4b4b64
|
|
| BLAKE2b-256 |
7096a86ed6b253628bc693a9c3a2da431739d50614129be94ed6d8e1b69ce616
|
Provenance
The following attestation bundles were made for blendconf-1.0.1.tar.gz:
Publisher:
python-publish.yml on hwmrocker/blendconf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
blendconf-1.0.1.tar.gz -
Subject digest:
45f6d3797af92c1df808b74fe4987b51d46ccc01a8402c640a07ecbe1ff50263 - Sigstore transparency entry: 829269944
- Sigstore integration time:
-
Permalink:
hwmrocker/blendconf@f134048ca4542bfcc5a19b5d22dd49ab24d88fc1 -
Branch / Tag:
refs/tags/1.0.1 - Owner: https://github.com/hwmrocker
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f134048ca4542bfcc5a19b5d22dd49ab24d88fc1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file blendconf-1.0.1-py3-none-any.whl.
File metadata
- Download URL: blendconf-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.8 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 |
2ad007d516db78440b8c823ac1129521f381e53852618c678e3658fd13a3ca9f
|
|
| MD5 |
fc0d965ee27333906a97c52f2d06060f
|
|
| BLAKE2b-256 |
b5f2ac646ed7dfcba6e8d9bae3d803956c11c638ac08125da16356b4827d65d2
|
Provenance
The following attestation bundles were made for blendconf-1.0.1-py3-none-any.whl:
Publisher:
python-publish.yml on hwmrocker/blendconf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
blendconf-1.0.1-py3-none-any.whl -
Subject digest:
2ad007d516db78440b8c823ac1129521f381e53852618c678e3658fd13a3ca9f - Sigstore transparency entry: 829269946
- Sigstore integration time:
-
Permalink:
hwmrocker/blendconf@f134048ca4542bfcc5a19b5d22dd49ab24d88fc1 -
Branch / Tag:
refs/tags/1.0.1 - Owner: https://github.com/hwmrocker
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f134048ca4542bfcc5a19b5d22dd49ab24d88fc1 -
Trigger Event:
release
-
Statement type: