Package: configmate
ConfigMatePractical and versatile configuration parsing in PythonConfigMatestreamlines heavyweight config parsing into a sleek,
zero-boilerplate experience that lets you configure with confidence.Key FeaturesExtensible file format support: Automatic detection & 
  parsing of all standard config file formats.Environment variable interpolation: Parse environment 
  variables while keeping defaults in your configuration file.Override files: Segregate base configuration management 
  such as DEV/STAG/PROD overrides in separate files.CLI support: Override configuration values with files 
  or values directly from an automatically generated command line interface.Type validation: Custom validation support, and seamless 
  extension for Pydantic's fantastic validation capabilities.Get started with ConfigMateConfigMate simplifies your configuration management. Get started with these easy steps:InstallationInstall ConfigMate with all standard features:pipinstall"configmate[standard]"Alternatively, install with specific features (e.g., Pydantic):pipinstall"configmate[pydantic]"Set Up ConfigurationCreate a Configuration File:
In this example we will do YAML, but ConfigMate supports all standard config file formats(json, toml, ini - you name it):# config.yamlDatabase configuration:host:localhostport:${DB_PORT:8000}Load your config in python:
Use ConfigMate to load and validate configuration in your script:# example.pyimportconfigmateimportdataclasses@dataclasses.dataclassclassDatabaseConfig:host:strport:intconfig=configmate.get_config("config.yaml",section='Database configuration',validation=DatabaseConfig)print(config)Run Your Script with Different Configurations
Execute your script, and override configurations using environment variables or command-line arguments:# Default configurationpythonexample.py>>DatabaseConfig(host='localhost',port=8000)# Override port using an environment variableDB_PORT=9000pythonexample.py
>>DatabaseConfig(host='localhost',port=9000)# Override host using a command-line argumentpythonexample.py++hostforeignhost
>>DatabaseConfig(host='foreignhost',port=8000)Quick comparison with other config parsers| Feature / Package                     | ConfigMate | ConfigParser | File Parsers (TOML/YAML/...) | ArgParse | Pallets/Click | Google/Fire | OmegaConf | Hydra |
|---------------------------------------|:----------:|:------------:|:---------------------------:|:--------:|:-------------:|:-----------:|:---------:|:-----:|| No Boilerplate                        |     ✅     |      ❌      |              ✅             |    ❌    |      ❌       |     ✅      |    ❌     |  ✅   |
| Support for Multiple File Formats     |     ✅     |      ❌      |              ✅             |    ❌    |      ❌       |     ❌      |    ❌     |  ❌   |
| Hierarchical Configuration            |     ✅     |      ✅      |              ✅             |    ❌    |      ❌       |     ✅      |    ✅     |  ✅   |
| Command-line Interface (CLI) Support  |     ✅     |      ❌      |              ❌             |    ✅    |      ✅       |     ✅      |    ❌     |  ✅   |
| Type Validation                       |     ✅     |      ❌      |          Partial            |    ❌    |      ✅       |     ❌      |  Partial  | Partial|
| Environment Variable Interpolation    |     ✅     |      ✅      |              ❌             |    ❌    |      ❌       |     ❌      |    ✅     |  ✅   |
| Dependency Count                      |     Low    |      Low     |            Low              |    Low   |      Low      |     Low     |    Low    | Moderate |