{ "info": { "author": "Keigo Kawamura", "author_email": "kkawamura@logos.t.u-tokyo.ac.jp", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Hierarchical Argparse\n====\n\n[![PyPI](https://img.shields.io/pypi/v/hiargparse.svg)](https://pypi.org/project/hiargparse/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hiargparse.svg)](https://pypi.org/project/hiargparse/)\n[![PyPI - License](https://img.shields.io/pypi/l/hiargparse.svg)](https://pypi.org/project/hiargparse/)\n\n\nHiargparse is a hierarchical and highly sophisticated variant of [argparse](https://docs.python.org/3/library/argparse.html).\n\n## Minimal Code\n```python\nfrom hiargparse import ArgsProvider, Arg, ChildProvider, ArgumentParser\n\nchild = ArgsProvider(\n args=[Arg('baz', default=42)]\n)\nroot = ArgsProvider(\n args=[Arg('foo', default='bar')],\n child_providers=[ChildProvider(provider=child, name='child')]\n)\nparser = ArgumentParser()\nparser.add_arguments_from_provider(root)\nprint(parser.parse_args())\n```\n\n## Description\n\nHiargparse automatically generates the command-line arguments with your all classes in your tree-like module structures with minimal codings.\n\nSuppose you make a large module, and your hierarchically deep class, say `foo.bar.baz.ham.spam.Egg`, requires some arguments, say `heights` and `widths`.\n`Foo` makes an instance of `Bar`, `Bar` makes an instance of `Baz`, ..., and `Spam` makes an `Egg` which has the two arguments.\nWhen you want to pass them command-line options, you have to write the two, `heights` and `widths`, in the constructor of `Foo`, `Bar`, ..., and `Spam`.\nWhat if the `Egg` is updated and wants to require some new arguments, like `depth` or `length`?\nHiargparse passes the arguments directly to the classes without any black magics.\n\n## Features\n\nWith this module, you can\n\n- easily make hierarchical (tree-like) command-line arguments with [argparse](https://docs.python.org/3/library/argparse.html)\n - Each argument is automatically help-texted and grouped into `argparse.ArgumentGroup`.\n- get a more useful Namespace object than the original\n - Accessing with dict-like key, getting the child Namespace, converting to/from dictionaries, and so on\n- write/read the arguments to/from some configure files with well known formats\n - Currently we supports [yaml](http://yaml.org/) and [toml](https://github.com/toml-lang/toml).\n\nAlso, this module\n\n- is almost compatible with original argparse; you can gradually introduce it to your large projects.\n- works without command-line arguments; when you distribute your module with hiargparse,\nusers still can select whether to feed arguments to it with a command-line or programatic way.\n\nThis module is inspired by rlpytorch.args_provider in [FacebookAIResearch/ELF](https://github.com/facebookresearch/ELF).\n\n## Installation\n\n```bash\npip install hiargparse\n```\n\n## Requirements\n\n- python >= 3.6.0\n- typing_extensions (for typing\\_extentions.Protocol in python 3.6) >= 3.6.2.1\n- pyyaml >= 3.12 (only if you use yaml write/read)\n- toml >= 0.9.4 (only if you use toml write/read)\n\n## Examples\n\n- See [`/examples/example.py`](https://github.com/KKawamura1/hiargparse/blob/master/examples/example.py) to easy start.\n- You can use hiargparse with original ArgumentParser. See [`/examples/example_with_original.py`](https://github.com/KKawamura1/hiargparse/blob/master/examples/example_with_original.py).\n- If you want to use hiargparse without command-line arguments, see [`/examples/example_without_program_arguments.py`](https://github.com/KKawamura1/hiargparse/blob/master/examples/example_without_program_arguments.py).\n- [`/examples/example_write_and_read.py`](https://github.com/KKawamura1/hiargparse/blob/master/examples/example_write_and_read.py) describes how to write and read the arguments with a configure file.\n- A lot of things you can do with hiargparse are shown in [`/examples/complicated_example.py`](https://github.com/KKawamura1/hiargparse/blob/master/examples/complicated_example.py).\n\n## Contribution\n\n- Any contribution is welcome!\n- Fork the repo, create a branch, add your awesome changes, and make a new Pull Request.\n- If you find some bugs, please report in issue.\n\n## Author\n\n- Keigo Kawamura (Department of Electrical Engineering and Information Systems (EEIS), Graduate School of Engineering, The University of Tokyo)\n - kkawamura@logos.t.u-tokyo.ac.jp\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/KKawamura1/hiargparse", "keywords": "arguments argparse hierarchy", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "hiargparse", "package_url": "https://pypi.org/project/hiargparse/", "platform": "", "project_url": "https://pypi.org/project/hiargparse/", "project_urls": { "Homepage": "https://github.com/KKawamura1/hiargparse", "Source": "https://github.com/KKawamura1/hiargparse/" }, "release_url": "https://pypi.org/project/hiargparse/0.2.2/", "requires_dist": [ "typing-extensions (>=3.6.2.1)", "pyyaml", "toml" ], "requires_python": "~=3.6", "summary": "A hierarchical and highly sophisticated variant of argparse.", "version": "0.2.2" }, "last_serial": 3819673, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "0437cd02686534ee98a349f3b9ac7520", "sha256": "038257068b7bedd4ea38653f81b4f5e7f0156b1a66fd1622646a1848d184a848" }, "downloads": -1, "filename": "hiargparse-0.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "0437cd02686534ee98a349f3b9ac7520", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 24324, "upload_time": "2018-04-30T02:02:23", "url": "https://files.pythonhosted.org/packages/ea/25/e1a64ee8a5f8a17eedbf667bc386ccad0aca3edcaa5ca85b98b95151640b/hiargparse-0.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d080df4c18ea3b7ed8d32a68825a6cda", "sha256": "c1fe7fc676a1755b94b757437969c46ad3ddc8e916697a08ceeebf01f7fc94a9" }, "downloads": -1, "filename": "hiargparse-0.0.0.tar.gz", "has_sig": false, "md5_digest": "d080df4c18ea3b7ed8d32a68825a6cda", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 16453, "upload_time": "2018-04-30T02:02:25", "url": "https://files.pythonhosted.org/packages/fa/06/9271c3437d9a870872f8e4f31ff1f4ae2e869c9c358756ef0e7b4026d3d2/hiargparse-0.0.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "99ed68f83625f1cea67bc74d2045a7fc", "sha256": "7ec5f70aab96a85fca853a5d30e10fd2dea1e76f9f5d7f2a689310ec2f6b4462" }, "downloads": -1, "filename": "hiargparse-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "99ed68f83625f1cea67bc74d2045a7fc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 24633, "upload_time": "2018-04-30T02:02:24", "url": "https://files.pythonhosted.org/packages/5b/c1/0d8b27fc734c56a05d9916e2cec3e023d74a6389082ba365a0c25fb4a1fa/hiargparse-0.1.1-py3-none-any.whl" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "1e43be56c7cd125ba5759ad4e006a720", "sha256": "d848ce79079f295cd577a628e0ade3776747eb3dc7a646c18d64e67b1fcade22" }, "downloads": -1, "filename": "hiargparse-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1e43be56c7cd125ba5759ad4e006a720", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 24597, "upload_time": "2018-04-30T02:16:05", "url": "https://files.pythonhosted.org/packages/4b/ad/546714a20a46102692e7013383f06f3a91c5deef2cbbfa57c78c75aadc95/hiargparse-0.2.0-py3-none-any.whl" } ], "0.2.1a0": [ { "comment_text": "", "digests": { "md5": "a774f544c89e16d0c9ffce5b212268e8", "sha256": "8757bf408fdd9ec536f455229bff6af207a25bcb9392aaa3cca3e688845821c0" }, "downloads": -1, "filename": "hiargparse-0.2.1a0-py3-none-any.whl", "has_sig": false, "md5_digest": "a774f544c89e16d0c9ffce5b212268e8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 24638, "upload_time": "2018-04-30T02:28:47", "url": "https://files.pythonhosted.org/packages/15/37/61265e4fe01875026ba259b6ca963af3d9238553d6f3dcacc6455c296833/hiargparse-0.2.1a0-py3-none-any.whl" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "ee33dbc7a9a7977ce1afa90f78582fc2", "sha256": "0c4de17d2560a0db63f18d7775f6f13a9fd78badfffbb6078f36b9f0444cd926" }, "downloads": -1, "filename": "hiargparse-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "ee33dbc7a9a7977ce1afa90f78582fc2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 24622, "upload_time": "2018-04-30T02:34:16", "url": "https://files.pythonhosted.org/packages/7e/11/d3b6bd878d2259de0373630b27f870c22d337b6fde93040bf66943b7697c/hiargparse-0.2.2-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ee33dbc7a9a7977ce1afa90f78582fc2", "sha256": "0c4de17d2560a0db63f18d7775f6f13a9fd78badfffbb6078f36b9f0444cd926" }, "downloads": -1, "filename": "hiargparse-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "ee33dbc7a9a7977ce1afa90f78582fc2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 24622, "upload_time": "2018-04-30T02:34:16", "url": "https://files.pythonhosted.org/packages/7e/11/d3b6bd878d2259de0373630b27f870c22d337b6fde93040bf66943b7697c/hiargparse-0.2.2-py3-none-any.whl" } ] }