Name | konfigurator JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | A a simple python configuration management and object instantiation tool |
upload_time | 2025-07-15 07:45:02 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | MIT |
keywords |
config
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|

# konfigurator
**konfigurator** is a lightweight Python configuration management utility that allows you to define, override, and instantiate configuration dictionaries and Python classes from simple config files or command-line arguments.
Further, it allows you to instantiate objects from classes using import paths. In this way, *no global registry or any disclosure* of your private code is needed.
The instantiation via import path is inspired by https://github.com/Farama-Foundation/HighwayEnv
## Features
- Load Python-based configuration files as dictionaries.
- Override configuration parameters via command-line.
- Instantiate Python classes from config dictionaries using import paths.
## Installation
`cd` into repository and run
```bash
pip install .
````
To install in developer mode (with `pre-commit` and `pytest`) run
```bash
pip install -e .[dev,test]
```
## Usage
1. Load a configuration file
Your configuration file is a pure python file (e.g., config.py) should define a dictionary named config:
```python
# config.py
work_dir = "/tmp/my_work_dir"
class_config_1: {
"type": "my_module.MyClass",
"name": "default_name"
}
```
You will be able to instantiate an object from the configuration `class_config_1` (see ).
Load this configuration in Python:
```python
from konfigurator import load_config
config = load_config(config_path="config.py")
```
2. Override from command-line and save result
You can override nested config values via CLI and save the modified config to disk, e.g.:
```bash
python script.py \
--config config.py \
--override experiment_dir=/tmp/experiment \
--override class_config_1.name=overridden_name \
--override class_config_1.type=5.0
```
Currently, floats, ints, and booleans are converted into their respective type. Strings and other types remain strings.
3. Instantiate classes from config
Use the `instantiate_class_from_config` to build objects dynamically (IMPORTANT: the value for the key `type` defines the import path):
```python
from konfigurator import instantiate_object_from_config
class_config_1: {
"type": "my_module.MyClass",
"name": "default_name"
}
my_obj = instantiate_object_from_config(class_config_1)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "konfigurator",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "config",
"author": null,
"author_email": "Maxim Dolgov <maxim.dolgov@hs-pforzheim.de>",
"download_url": "https://files.pythonhosted.org/packages/78/8d/4e6927bdc8376248663694c9b5fcafeb74bfdba52380e3560ab94afc31b7/konfigurator-0.1.0.tar.gz",
"platform": null,
"description": "\n\n# konfigurator\n\n**konfigurator** is a lightweight Python configuration management utility that allows you to define, override, and instantiate configuration dictionaries and Python classes from simple config files or command-line arguments.\n\nFurther, it allows you to instantiate objects from classes using import paths. In this way, *no global registry or any disclosure* of your private code is needed.\n\nThe instantiation via import path is inspired by https://github.com/Farama-Foundation/HighwayEnv\n\n## Features\n\n- Load Python-based configuration files as dictionaries.\n- Override configuration parameters via command-line.\n- Instantiate Python classes from config dictionaries using import paths.\n\n## Installation\n`cd` into repository and run\n```bash\npip install .\n````\n\nTo install in developer mode (with `pre-commit` and `pytest`) run\n```bash\npip install -e .[dev,test]\n```\n\n## Usage\n\n1. Load a configuration file\n\n Your configuration file is a pure python file (e.g., config.py) should define a dictionary named config:\n ```python\n # config.py\n work_dir = \"/tmp/my_work_dir\"\n class_config_1: {\n \"type\": \"my_module.MyClass\",\n \"name\": \"default_name\"\n }\n ```\n You will be able to instantiate an object from the configuration `class_config_1` (see ).\n\n Load this configuration in Python:\n ```python\n from konfigurator import load_config\n\n config = load_config(config_path=\"config.py\")\n ```\n\n2. Override from command-line and save result\n\n You can override nested config values via CLI and save the modified config to disk, e.g.:\n ```bash\n python script.py \\\n --config config.py \\\n --override experiment_dir=/tmp/experiment \\\n --override class_config_1.name=overridden_name \\\n --override class_config_1.type=5.0\n ```\n Currently, floats, ints, and booleans are converted into their respective type. Strings and other types remain strings.\n\n3. Instantiate classes from config\n\n Use the `instantiate_class_from_config` to build objects dynamically (IMPORTANT: the value for the key `type` defines the import path):\n ```python\n from konfigurator import instantiate_object_from_config\n\n class_config_1: {\n \"type\": \"my_module.MyClass\",\n \"name\": \"default_name\"\n }\n\n my_obj = instantiate_object_from_config(class_config_1)\n ```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A a simple python configuration management and object instantiation tool",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/isealab/konfigurator"
},
"split_keywords": [
"config"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "803e7b1aefed6ce34806934d9fb2e8f58e55fdf33d28c7f6467bd296a1f5627c",
"md5": "fb1f37d525e05428717105355da31246",
"sha256": "439cd9fd46abada96ee25c6d17c9198c179617ae0ba4c73dfc4669ed26ada415"
},
"downloads": -1,
"filename": "konfigurator-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fb1f37d525e05428717105355da31246",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 6126,
"upload_time": "2025-07-15T07:45:01",
"upload_time_iso_8601": "2025-07-15T07:45:01.092781Z",
"url": "https://files.pythonhosted.org/packages/80/3e/7b1aefed6ce34806934d9fb2e8f58e55fdf33d28c7f6467bd296a1f5627c/konfigurator-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "788d4e6927bdc8376248663694c9b5fcafeb74bfdba52380e3560ab94afc31b7",
"md5": "e1db0918569ab695b3b13c0da65fd273",
"sha256": "0c39bc46f9bd15fa49d7d287174ebd99be8e561e27f3c160d36742d5f92c5bd9"
},
"downloads": -1,
"filename": "konfigurator-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "e1db0918569ab695b3b13c0da65fd273",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 5101,
"upload_time": "2025-07-15T07:45:02",
"upload_time_iso_8601": "2025-07-15T07:45:02.101061Z",
"url": "https://files.pythonhosted.org/packages/78/8d/4e6927bdc8376248663694c9b5fcafeb74bfdba52380e3560ab94afc31b7/konfigurator-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-15 07:45:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "isealab",
"github_project": "konfigurator",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "konfigurator"
}