{"id":15698260,"url":"https://github.com/vfdev-5/py_config_runner","last_synced_at":"2025-05-08T22:40:37.276Z","repository":{"id":35047584,"uuid":"200425762","full_name":"vfdev-5/py_config_runner","owner":"vfdev-5","description":"Python configuration file and command line executable to run a script with.","archived":false,"fork":false,"pushed_at":"2023-11-05T01:10:54.000Z","size":77,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-17T18:12:09.592Z","etag":null,"topics":["configuration","deep-learning","machine-learning","python","runner"],"latest_commit_sha":null,"homepage":"https://py-config-runner.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vfdev-5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-03T22:18:32.000Z","updated_at":"2023-09-12T15:16:26.000Z","dependencies_parsed_at":"2024-10-24T02:57:53.571Z","dependency_job_id":"12c3ffb7-0930-418c-9364-b7392c94b214","html_url":"https://github.com/vfdev-5/py_config_runner","commit_stats":{"total_commits":34,"total_committers":2,"mean_commits":17.0,"dds":0.02941176470588236,"last_synced_commit":"b8e1fa472e069b99a750e55bd01edc6fdc817a9b"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfdev-5%2Fpy_config_runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfdev-5%2Fpy_config_runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfdev-5%2Fpy_config_runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfdev-5%2Fpy_config_runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vfdev-5","download_url":"https://codeload.github.com/vfdev-5/py_config_runner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253160727,"owners_count":21863624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration","deep-learning","machine-learning","python","runner"],"created_at":"2024-10-03T19:24:37.332Z","updated_at":"2025-05-08T22:40:37.252Z","avatar_url":"https://github.com/vfdev-5.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Configuration and a command line Runner\n\n[![Nightly tests](https://github.com/vfdev-5/py_config_runner/actions/workflows/nightly-tests.yml/badge.svg)](https://github.com/vfdev-5/py_config_runner/actions/workflows/nightly-tests.yml)\n[![CircleCI](https://circleci.com/gh/vfdev-5/py_config_runner/tree/master.svg?style=svg)](https://circleci.com/gh/vfdev-5/py_config_runner/tree/master)\n[![codecov](https://codecov.io/gh/vfdev-5/py_config_runner/branch/master/graph/badge.svg)](https://codecov.io/gh/vfdev-5/py_config_runner)\n[![Documentation Status](https://readthedocs.org/projects/py-config-runner/badge/?version=latest)](https://py-config-runner.readthedocs.io/en/latest/?badge=latest)\n[![image](https://img.shields.io/badge/dynamic/json.svg?label=PyPI\u0026url=https%3A%2F%2Fpypi.org%2Fpypi%2Fpy_config_runner%2Fjson\u0026query=%24.info.version\u0026colorB=brightgreen\u0026prefix=v)](https://pypi.org/project/py-config-runner/)\n\n\nPython configuration file and command line executable to run a script with.\n\n**Why a python file as configuration?**\n\n- Configuration of any complexity\n- No need to serialize the configuration\n- No need other meta-languages for the configuration\n\n\n## Usage\n\n### In the code\n\nConfiguration file (e.g. `config.py`):\n```python\nnum_epochs = 100\nbatch_size = 256\n\nmodel = resnet18(10)\ntrain_loader = get_train_loader(\"/path/to/dataset\", batch_size=batch_size)\nunsup_dataloader = get_train_unsup_loader(\"/path/to/unsup_dataset\", batch_size=batch_size)\n...\n```\n\nScript file (e.g. `training.py`):\n```python\nfrom torch.utils.data import DataLoader\nfrom py_config_runner import ConfigObject, TrainvalConfigSchema\n\n\nclass SSLTrainvalConfigSchema(TrainvalConfigSchema):\n\n    unsup_dataloader: DataLoader\n\n\n\ndef training(config):\n    # ...\n    print(config.config_filepath)\n    print(config.output_path)\n    print(config.num_epochs)\n    print(config.model)\n    print(len(config.train_loader))\n\n\ndef main():\n\n    config_filepath = \"/path/to/config.py\"\n    config = ConfigObject(config_filepath)\n\n    SSLTrainvalConfigSchema.validate(config)\n\n    # Add more things at runtime    \n    config.output_path = \"/tmp/output\"\n\n    training(config)\n\n```\n\n\n### With launcher\n\n```bash\ncd /path/to/my/project\npy_config_runner scripts/training.py configs/train/baseline.py\n```\n\nor\n\n```bash\ncd /path/to/my/project\npython -u -m py_config_runner scripts/training.py configs/train/baseline.py\n```\n\nor if your specific launcher requires only python script files:\n \n```bash\ncd /path/to/my/project\npython -m special_launcher `py_config_runner_script` scripts/training.py configs/train/baseline.py\n```\n\n\nThe only condition on the script file is it should contain `run(config, **kwargs)` callable method. Additionally, \nargument kwargs contains `logger` (e.g. `kwargs['logger']`) and `local_rank` (e.g. `kwargs['logger']`) \nfor distributed computations.\n\n\nNo restrictions are applied on the configuration file. It is user's responsibility to provide the script file that can \nconsume given configuration file. Provided configuration file is loaded as python module and exposed into the script as \nthe module named `config`.\n\n### Examples\n\n- [Example for Machine/Deep Learning](examples/README.md)\n\n## Installation\n\n```bash\npip install py-config-runner\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfdev-5%2Fpy_config_runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvfdev-5%2Fpy_config_runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfdev-5%2Fpy_config_runner/lists"}