pydantic-config-builder
A tool to build YAML configurations by merging multiple files.
Features
- Merge multiple YAML files into a single configuration file
- Support for base configuration files with overlay files
- Recursive merging of dictionaries and arrays
- Use built configurations as base for other configurations
- Configuration file based build management
- Command line interface tool
- Support for relative and absolute paths
- Home directory expansion with ~
Installation
pip install pydantic-config-builder
Usage
Create a configuration file named pydantic_config_builder.yml in your project directory:
# New format (recommended)
development:
input:
- base/*.yaml # All YAML files in base directory
- path/to/base.yaml # Specific file
output:
- default.yaml # Local output
- ~/.config/app.yaml # Global config
- build/dev.yaml # Build output
production:
input:
- default.yaml # Use output of another configuration
- configs/**/*.yaml # All YAML files in configs and subdirectories
- /path/to/overlay-*.yaml # All overlay files in specific directory
output:
- prod.yaml
- /etc/app/config.yaml
# Legacy format (still supported)
default.yaml:
- base/*.yaml
- path/to/base.yaml
Then run the builder:
# Use default configuration file (pydantic_config_builder.yml)
pydantic_config_builder
# Or specify a configuration file
pydantic_config_builder -c path/to/config.yml
# Enable verbose output
pydantic_config_builder -v
Path Resolution
- Absolute paths (starting with /) are used as is
- Paths starting with ~ are expanded to the user's home directory
- Relative paths are resolved relative to the configuration file's directory
- Glob patterns (*, ?, []) are supported for source files
*.yamlmatches all YAML files in the current directory**/*.yamlmatches all YAML files recursively in subdirectories- If a pattern matches no files, a warning is printed and the pattern is skipped
Merging Behavior
- Dictionaries are merged recursively, with later files overwriting earlier ones
- Arrays are replaced entirely (not appended or merged by index)
Example
Given these files:
base.yaml:
database:
host: localhost
port: 5432
credentials:
username: admin
logging:
level: info
overlay.yaml:
database:
port: 5433
credentials:
password: secret
logging:
format: json
And this configuration:
# pydantic_config_builder.yml
config.yaml:
- base.yaml
- overlay.yaml
The resulting config.yaml will be:
database:
host: localhost
port: 5433
credentials:
username: admin
password: secret
logging:
level: info
format: json
Documentation
For more detailed documentation, please see the GitHub repository.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for pydantic-config-builder 0.5.1
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 |
|---|---|---|---|---|
| pydantic_config_builder-0.5.1.tar.gz | 6.1 kB | Without provenance | Details for pydantic_config_builder-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydantic_config_builder-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for pydantic_config_builder-0.5.1-py3-none-any.whl |
Total release size: 14.0 kB
Release files / pydantic_config_builder-0.5.1.tar.gz
| Download URL | pydantic_config_builder-0.5.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eaa4aa980b1d82f8df5675ee8041ca29cd395d37bcf79bc910ddf49a966a093a
|
|
BLAKE2b-256 checksum How to use checksums |
184fd349647e98fbbf0b0fb93d17900a175ec7ccfe01beca0c8737a18273515e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.11 Darwin/24.5.0
|
Release files / pydantic_config_builder-0.5.1-py3-none-any.whl
| Download URL | pydantic_config_builder-0.5.1-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e75f48091d8d6277a09b6901558afc32efb9a45f9470eff9aac3ceb9cee07dfb
|
|
BLAKE2b-256 checksum How to use checksums |
cf58d841818171a33b0037b905960f391d5402b4e76310e32e95aedada385f50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.11 Darwin/24.5.0
|
Security for pydantic-config-builder 0.5.1
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.