{"id":17679329,"url":"https://github.com/bbkane/argconfig","last_synced_at":"2025-09-06T06:33:14.780Z","repository":{"id":87170747,"uuid":"101821234","full_name":"bbkane/argconfig","owner":"bbkane","description":"A wrapper around argparse that allows configuration files","archived":false,"fork":false,"pushed_at":"2017-10-22T23:40:49.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-02T11:56:18.618Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbkane.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-08-30T00:57:07.000Z","updated_at":"2017-08-30T00:57:27.000Z","dependencies_parsed_at":"2023-03-13T19:44:50.386Z","dependency_job_id":null,"html_url":"https://github.com/bbkane/argconfig","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bbkane/argconfig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbkane%2Fargconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbkane%2Fargconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbkane%2Fargconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbkane%2Fargconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbkane","download_url":"https://codeload.github.com/bbkane/argconfig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbkane%2Fargconfig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273867440,"owners_count":25182423,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-24T08:22:07.362Z","updated_at":"2025-09-06T06:33:14.757Z","avatar_url":"https://github.com/bbkane.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"argconfig\n=========\n\n*Not Ready For Usage Yet*\n-------------------------\n\nThis module wraps ``argparse.ArgumentParser`` so arguments passed to it\ncan be overwritten in the following order:\n\n-  script default configuration - overwritten by any of the following\n-  system config\n-  user config\n-  environmental variables (with an optional prefix)\n-  explicitly passed config\n-  explicitly passed arguments - never overwritten\n\nSample usage:\n-------------\n\n-  in file ``addem.py``:\n\nTODO: add actual config stuff here...\n\n.. code:: python\n\n    parser = argparse.ArgumentParser(description='Process some integers.')\n    parser.add_argument('--integers', metavar='N', type=int, nargs='+',\n                        default=[1, 2, 3],\n                        help='an integer for the accumulator')\n    parser.add_argument('--sum', dest='accumulate', action='store_const',\n                        const='sum', default='max',\n                        help='sum the integers (default: find the max)')\n\n    options = ArgumentConfig(parser)\n\n    o = options.parse_args()\n\n    print(o)\n\n-  in file ``config.json``:\n\n.. code:: json\n\n    {\n        \"accumulate\": \"max\",\n        \"integers\": [\n            1,\n            2,\n            3\n        ]\n    }\n\nThen call it like so:\n\n.. code:: bash\n\n    python addem.py -c config.json --sum\n\nNotes\n-----\n\nThis isn't 100% compatible with ``argparse``. In general, your arguments\nmust resolve to JSON serializable types (``int``, ``string``, etc.). In\nparticular, you can't assign a function to the ``default`` or ``const``\narguments in your parser. As I like to dispatch actions from a central\nmain function anyway, this hasn't bothered me.\n\nI'm using reStructuredText instead of Markdown so I can upload this as the PyPy package index more easily.\n\nConvert between extensions (in this case ``md`` and ``rst``) with ``pandoc -o \u003cname\u003e.rst \u003cname.md``\n\nI'm following the guide at `the python-packaging readthedocs \u003chttps://python-packaging.readthedocs.io/en/latest/index.html\u003e`__.\n\nThat's pretty much done. Now I'm using the docs at `pytest \u003chttps://docs.pytest.org/en/latest/goodpractices.html#goodpractices\u003e`__ to use py.test with this.\n\nInstall and Test\n----------------\n\n.. code:: bash\n\n    cd ~/Git/\n    git clone https://github.com/bbkane/argconfig.git\n    cd argconfig\n    conda create --name argconfig python=3\n    source activate argconfig\n    pip install -e .\n    python setup.py test\n    # run with pdb for debugging\n    python setup.py test --addopts --pdb\n    # run tests on save (requires entr)\n    git ls-files | entr python setup.py test\n\nTODO:\n-----\n\n- config backends:\n\n  - configobj\n  - env\n  - pyyaml (requires an optional dependency)\n  - api?\n\n- comments in the JSON\n- write parsers in other things than JSON\n- change write_config to output other things than JSON\n- make --list-overrides not look so ugly (add things to specify what is overriding what)\n- add docs\n- put library commands in subparser?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbkane%2Fargconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbkane%2Fargconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbkane%2Fargconfig/lists"}