<p align="center">
<a href="#readme">
<img alt="ConfigMate Logo" src="https://i.imgur.com/7DaKfnc.png" style="height: 172px;">
</a>
</p>
<h1 align="center" style="font-size: 2.5em; margin: 0; padding: 0;">ConfigMate</h1>
<p align="center" style="font-size: 1.2em; font-weight: 300; color: #555; margin: 0;">
Practical and versatile configuration parsing in Python
</p>
<p align="center">
<a href="https://pypi.python.org/pypi/configmate"><img alt="Pypi version" src="https://img.shields.io/pypi/v/configmate.svg"></a>
<a href="https://pypi.python.org/pypi/configmate"><img alt="Python versions" src="https://img.shields.io/badge/python-3.8%5E-blue.svg"></a>
<a href="https://pypi.python.org/pypi/configmate"><img alt="Downloads" src="https://img.shields.io/pypi/dm/configmate"></a>
<a href="https://app.codacy.com/gh/ArthurBook/configmate/dashboard"><img alt="Code quality" src="https://img.shields.io/codacy/grade/451b032d35a2452ea05f14d66c30c8f3.svg"></a>
<a href="https://github.com/ArthurBook/configmate/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/github/license/ArthurBook/configmate"></a>
</p>
***
<p><strong>ConfigMate</strong> streamlines heavyweight config parsing into a sleek,
zero-boilerplate experience that lets you configure with confidence.</p>
<h2>Key Features</h2>
<ul>
<li><strong>Extensible file format support</strong>: Automatic detection &
parsing of all standard config file formats.</li>
<li><strong>Environment variable interpolation</strong>: Parse environment
variables while keeping defaults in your configuration file.</li>
<li><strong>Override files</strong>: Segregate base configuration management
such as DEV/STAG/PROD overrides in separate files.</li>
<li><strong>CLI support</strong>: Override configuration values with files
or values directly from an automatically generated command line interface.</li>
<li><strong>Type validation</strong>: Custom validation support, and seamless
extension for Pydantic's fantastic validation capabilities.</li>
</ul>
## Get started with ConfigMate
ConfigMate simplifies your configuration management. Get started with these easy steps:
### Installation
Install ConfigMate with all standard features:
```bash
pip install "configmate[standard]"
```
Alternatively, install with specific features (e.g., Pydantic):
```bash
pip install "configmate[pydantic]"
```
#### Set Up Configuration
1. Create a Configuration File:
In this example we will do YAML, but ConfigMate supports all standard config file formats(json, toml, ini - you name it):
```yaml
# config.yaml
Database configuration:
host: localhost
port: ${DB_PORT:8000}
```
2. Load your config in python:
Use ConfigMate to load and validate configuration in your script:
```python
# example.py
import configmate
import dataclasses
@dataclasses.dataclass
class DatabaseConfig:
host: str
port: int
config = configmate.get_config(
"config.yaml",
section='Database configuration',
validation=DatabaseConfig
)
print(config)
```
3. Run Your Script with Different Configurations
Execute your script, and override configurations using environment variables or command-line arguments:
```bash
# Default configuration
python example.py
>> DatabaseConfig(host='localhost', port=8000)
# Override port using an environment variable
DB_PORT=9000 python example.py
>> DatabaseConfig(host='localhost', port=9000)
# Override host using a command-line argument
python example.py ++host foreignhost
>> 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 |
Raw data
{
"_id": null,
"home_page": "",
"name": "configmate",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "configuration,config,parser,config-parser",
"author": "Arthur B\u00f6\u00f6k",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/1b/87/a21ecd73bab2a82abc48f913e70169a3cc564e6c2dd5323e433bd4c63f3d/configmate-0.1.8.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <a href=\"#readme\">\n <img alt=\"ConfigMate Logo\" src=\"https://i.imgur.com/7DaKfnc.png\" style=\"height: 172px;\">\n </a>\n</p>\n<h1 align=\"center\" style=\"font-size: 2.5em; margin: 0; padding: 0;\">ConfigMate</h1>\n<p align=\"center\" style=\"font-size: 1.2em; font-weight: 300; color: #555; margin: 0;\">\n Practical and versatile configuration parsing in Python\n</p>\n<p align=\"center\">\n <a href=\"https://pypi.python.org/pypi/configmate\"><img alt=\"Pypi version\" src=\"https://img.shields.io/pypi/v/configmate.svg\"></a>\n <a href=\"https://pypi.python.org/pypi/configmate\"><img alt=\"Python versions\" src=\"https://img.shields.io/badge/python-3.8%5E-blue.svg\"></a>\n <a href=\"https://pypi.python.org/pypi/configmate\"><img alt=\"Downloads\" src=\"https://img.shields.io/pypi/dm/configmate\"></a>\n <a href=\"https://app.codacy.com/gh/ArthurBook/configmate/dashboard\"><img alt=\"Code quality\" src=\"https://img.shields.io/codacy/grade/451b032d35a2452ea05f14d66c30c8f3.svg\"></a>\n <a href=\"https://github.com/ArthurBook/configmate/blob/master/LICENSE\"><img alt=\"License\" src=\"https://img.shields.io/github/license/ArthurBook/configmate\"></a>\n</p>\n\n***\n\n<p><strong>ConfigMate</strong> streamlines heavyweight config parsing into a sleek,\nzero-boilerplate experience that lets you configure with confidence.</p>\n\n<h2>Key Features</h2>\n\n<ul>\n <li><strong>Extensible file format support</strong>: Automatic detection & \n parsing of all standard config file formats.</li>\n\n <li><strong>Environment variable interpolation</strong>: Parse environment \n variables while keeping defaults in your configuration file.</li>\n\n <li><strong>Override files</strong>: Segregate base configuration management \n such as DEV/STAG/PROD overrides in separate files.</li>\n\n <li><strong>CLI support</strong>: Override configuration values with files \n or values directly from an automatically generated command line interface.</li>\n\n <li><strong>Type validation</strong>: Custom validation support, and seamless \n extension for Pydantic's fantastic validation capabilities.</li>\n</ul>\n\n## Get started with ConfigMate\n\nConfigMate simplifies your configuration management. Get started with these easy steps:\n\n### Installation\n\nInstall ConfigMate with all standard features:\n\n```bash\npip install \"configmate[standard]\"\n```\n\nAlternatively, install with specific features (e.g., Pydantic):\n\n```bash\npip install \"configmate[pydantic]\"\n```\n\n#### Set Up Configuration\n\n1. Create a Configuration File:\n In this example we will do YAML, but ConfigMate supports all standard config file formats(json, toml, ini - you name it):\n\n```yaml\n# config.yaml\nDatabase configuration:\n host: localhost\n port: ${DB_PORT:8000}\n```\n\n2. Load your config in python:\n Use ConfigMate to load and validate configuration in your script:\n\n```python\n# example.py\nimport configmate\nimport dataclasses\n\n@dataclasses.dataclass\nclass DatabaseConfig:\n host: str\n port: int\n\nconfig = configmate.get_config(\n \"config.yaml\", \n section='Database configuration', \n validation=DatabaseConfig\n)\nprint(config)\n```\n\n3. Run Your Script with Different Configurations\n Execute your script, and override configurations using environment variables or command-line arguments:\n\n```bash\n# Default configuration\npython example.py \n>> DatabaseConfig(host='localhost', port=8000)\n\n# Override port using an environment variable\nDB_PORT=9000 python example.py\n>> DatabaseConfig(host='localhost', port=9000)\n\n# Override host using a command-line argument\npython example.py ++host foreignhost\n>> DatabaseConfig(host='foreignhost', port=8000)\n```\n\n## Quick comparison with other config parsers\n\n| Feature / Package | ConfigMate | ConfigParser | File Parsers (TOML/YAML/...) | ArgParse | Pallets/Click | Google/Fire | OmegaConf | Hydra |\n|---------------------------------------|:----------:|:------------:|:---------------------------:|:--------:|:-------------:|:-----------:|:---------:|:-----:|\\\n| No Boilerplate | \u2705 | \u274c | \u2705 | \u274c | \u274c | \u2705 | \u274c | \u2705 |\n| Support for Multiple File Formats | \u2705 | \u274c | \u2705 | \u274c | \u274c | \u274c | \u274c | \u274c |\n| Hierarchical Configuration | \u2705 | \u2705 | \u2705 | \u274c | \u274c | \u2705 | \u2705 | \u2705 |\n| Command-line Interface (CLI) Support | \u2705 | \u274c | \u274c | \u2705 | \u2705 | \u2705 | \u274c | \u2705 |\n| Type Validation | \u2705 | \u274c | Partial | \u274c | \u2705 | \u274c | Partial | Partial|\n| Environment Variable Interpolation | \u2705 | \u2705 | \u274c | \u274c | \u274c | \u274c | \u2705 | \u2705 |\n| Dependency Count | Low | Low | Low | Low | Low | Low | Low | Moderate |\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "Practical and versatile configuration parsing in Python.",
"version": "0.1.8",
"project_urls": {
"repository": "https://github.com/ArthurBook/configmate"
},
"split_keywords": [
"configuration",
"config",
"parser",
"config-parser"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f77cc11447f679c1cfaedc4f7901fe19419491c48ff403743fca65572b052768",
"md5": "f003e810c1804bde0b729b2258a47b38",
"sha256": "28c454f01c55a57c379557df5a398775cd56baf8828c8ca77dc6a5e830e33972"
},
"downloads": -1,
"filename": "configmate-0.1.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f003e810c1804bde0b729b2258a47b38",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 28542,
"upload_time": "2024-02-17T00:18:15",
"upload_time_iso_8601": "2024-02-17T00:18:15.761368Z",
"url": "https://files.pythonhosted.org/packages/f7/7c/c11447f679c1cfaedc4f7901fe19419491c48ff403743fca65572b052768/configmate-0.1.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1b87a21ecd73bab2a82abc48f913e70169a3cc564e6c2dd5323e433bd4c63f3d",
"md5": "9ce7d0d7686829eaee8226eb5df8ce77",
"sha256": "654de0fd78d2938e5546534a2ad90e62bcf5bca0524bc112f602a39d58a9304a"
},
"downloads": -1,
"filename": "configmate-0.1.8.tar.gz",
"has_sig": false,
"md5_digest": "9ce7d0d7686829eaee8226eb5df8ce77",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 19439,
"upload_time": "2024-02-17T00:18:17",
"upload_time_iso_8601": "2024-02-17T00:18:17.446230Z",
"url": "https://files.pythonhosted.org/packages/1b/87/a21ecd73bab2a82abc48f913e70169a3cc564e6c2dd5323e433bd4c63f3d/configmate-0.1.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-17 00:18:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ArthurBook",
"github_project": "configmate",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "configmate"
}