{ "info": { "author": "mayansalama", "author_email": "micsalama@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# DocCli\n\nPython 3.6+ utility to build Classes that can be easily modified to create a Python\nArgparse specification. The goal of this is to couple a CLI specification to a config\nclass, making them quicker to build and less likely to break.\n\nThis leans heavily on the [Decli](https://github.com/Woile/decli) library\nto generate Argparse objects.\n\n## Creating CLI Objects\n\nCLI objects can be created automatically from a class definition, reading in default\nvalues and descriptions from type hints and the docstring.\n\n```python\nfrom doccli import DocCliParser\n\nclass CliTool:\n command_name = \"cli-tool\"\n def __init__(self, _non_cli_param: str, param_a: str, param_b, param_c: int = 5):\n \"\"\"This is the command description\n\n Args:\n _non_cli_param (str): Underscore leading params aren't included in the\n CLI specs\n param_a: A required parameter\n param_b: Note that the type needs to come from the annotation\n param_c: This one has a default\n \"\"\"\n\n self.param_a = param_a\n self.param_b = param_b\n self.param_c = param_c\n\n self.non_cli_param = non_cli_param\n\n# To create the argparse object:\nif __name__ == \"__main__\":\n args = DocliParser(CliTool).parse_args()\n ...\n```\n\nSee [examples](examples/) for more examples, including how to create CLIs with\n[subcommands](examples/subcommands.py).\n\n## Config File Helpers\n\nDocCli also provides the `ConfigUtil` class which can be used to automatically\ncreate Yaml config files. These include the ability to:\n\n- Infer config specifications from the `__init__` method\n- Convert an instantiated object into a dictionary\n - This will ignore config values that have the same value as their default\n- Ability to nest Config objects in other objects, to create centralised config files\n - A sub-config object can still be instantiated from the super YAML file\n\nObjects inheriting from the `ConfigUtil` class can set the following class level\nvariables:\n\n- config_key: str\n - Parameters for this object. Defaults to the class name\n- sub_config_list: List\n - A list of Config Classes that also inherit from ConfigUtil, and are children of this class\n- flatten_sub_configs: bool\n - Defaults to True. When reading from/writing to a dict, sub_configs will either be recorded\n as sub-dictionaries, or at the same level as the config items for the current dictionary.\n\n## Using them together\n\nThese tools can be used together to create a config class that can:\n\n- Generate a CLI parser\n- Initiate from a CLI parser, while also filling in unsupplied values from a Config file\n- Write supplied values to a config file so they can be remembered later\n\nDocliParser has the method `parse_args_with_config_file`, which will attempt to\nfill in any unprovided arguments with values provided in the Config File. Note that\nthis will only work if:\n\n- The variables are stored as top-level keys in the file\n- The variables are stored in a sub-dictionary under the same key as the subcommand name\n- If the subcommand class inherits from `ConfigUtil` and the variables are stored in a\n sub-dictionary under the same key as the ConfigUtil.config_key variable\n\nAn example of this can be seen in [examples](examples/webserver_conf.py)\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/mayansalama/doccli/", "keywords": "", "license": "Apache-2.0", "maintainer": "", "maintainer_email": "", "name": "doc-cli", "package_url": "https://pypi.org/project/doc-cli/", "platform": "", "project_url": "https://pypi.org/project/doc-cli/", "project_urls": { "Homepage": "https://github.com/mayansalama/doccli/", "Repository": "https://github.com/mayansalama/doccli" }, "release_url": "https://pypi.org/project/doc-cli/0.0.4/", "requires_dist": [ "decli (>=0.5.1,<0.6.0)", "docstring-parser (>=0.3,<0.4)", "pyyaml (>=5.1.2,<6.0.0)" ], "requires_python": ">=3.6,<4.0", "summary": "Build Config classes that can be quickly turned into CLI specifications", "version": "0.0.4" }, "last_serial": 5910253, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "1b9333632834b68e6f15a0ead5f6e81a", "sha256": "df78ea06e7792aa1cb09b52106140f3304e2a3af1d107e111c8f2c625579fae8" }, "downloads": -1, "filename": "doc_cli-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1b9333632834b68e6f15a0ead5f6e81a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 7083, "upload_time": "2019-09-29T04:08:40", "url": "https://files.pythonhosted.org/packages/52/19/374183fa62951d631591898373c680310d3cd87d26158f3a024629a9d7ef/doc_cli-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "017e832236c580e5abf657d21a540013", "sha256": "3783bbf50cc2d3b52303dc9edc287b7efd14702ef355741d378d46b10ea62cc0" }, "downloads": -1, "filename": "doc-cli-0.0.1.tar.gz", "has_sig": false, "md5_digest": "017e832236c580e5abf657d21a540013", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 6930, "upload_time": "2019-09-29T04:08:37", "url": "https://files.pythonhosted.org/packages/e7/89/bc75176f6fb982dd36d566ef6dd810a9e74331f09e67c522b3eed5e3f097/doc-cli-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "cc92cd4f832673f1b54c25b5b257641c", "sha256": "2ba5bee3f0012d80cdc1fedd460c8622e75d9a00b98da893c91640f29503cae0" }, "downloads": -1, "filename": "doc_cli-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "cc92cd4f832673f1b54c25b5b257641c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 10743, "upload_time": "2019-09-30T14:05:54", "url": "https://files.pythonhosted.org/packages/d7/c9/879d86b5b82a0a0f2cd9292f18ed5dd825136276bb947bc166d6be029258/doc_cli-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b2ff36579135c886d01d7428b08d9ecf", "sha256": "417acee8dca129e001391560b755cc65f838f0e2c36afdf5e4549c961af98538" }, "downloads": -1, "filename": "doc-cli-0.0.2.tar.gz", "has_sig": false, "md5_digest": "b2ff36579135c886d01d7428b08d9ecf", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 10080, "upload_time": "2019-09-30T14:05:53", "url": "https://files.pythonhosted.org/packages/6a/06/5f84ff5d07eed81c517a2c43b2908135adf2a78963af4d1fd56815caf442/doc-cli-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "a0d8e25243fb1691ee7ee99bb809f19b", "sha256": "28ba3b7efa70bd371239e709ba5e2b2813e3c1d8d000d953e5e0ca4d08cf2e5d" }, "downloads": -1, "filename": "doc_cli-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "a0d8e25243fb1691ee7ee99bb809f19b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 10765, "upload_time": "2019-10-01T03:43:51", "url": "https://files.pythonhosted.org/packages/c1/57/32ec27c9d108b2322915e0961c622ef9af7f3f13cfb7846428f9b212fa9c/doc_cli-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5325ba1094bb5c085acce69fd29c72ae", "sha256": "8d1fae1b9be4a1a90f2866e71a85548bb6b281e3ecb42573bfa69ec2ff266d92" }, "downloads": -1, "filename": "doc-cli-0.0.3.tar.gz", "has_sig": false, "md5_digest": "5325ba1094bb5c085acce69fd29c72ae", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 10123, "upload_time": "2019-10-01T03:43:49", "url": "https://files.pythonhosted.org/packages/8a/61/ac2b92dff9e3750da96aac795cb3801d63cfaafa459da5a6ac80d1e01f48/doc-cli-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "b1d513be37a912e9e50d5ddf314a4e8f", "sha256": "dd72179249e6a156ae8f9d96dddf71dfcdd86a750469518a604e8e885f46bbd4" }, "downloads": -1, "filename": "doc_cli-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "b1d513be37a912e9e50d5ddf314a4e8f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 10771, "upload_time": "2019-10-01T03:55:47", "url": "https://files.pythonhosted.org/packages/bd/58/ca1981cd841e132cec8ea7cedcb0a16526cbe798aeb43fceea2e59ca9c9a/doc_cli-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b260bb5ebe6b9459b006bedfef5ace18", "sha256": "e558f08ff2538433b68d920f9a5a786f80873975603784f4dc3f0dfdac2d30ab" }, "downloads": -1, "filename": "doc-cli-0.0.4.tar.gz", "has_sig": false, "md5_digest": "b260bb5ebe6b9459b006bedfef5ace18", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 10137, "upload_time": "2019-10-01T03:55:45", "url": "https://files.pythonhosted.org/packages/c0/75/4d359fc90d9732817de4d27e8f1f3751ddd878fbebd27631403db5ebe6d7/doc-cli-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b1d513be37a912e9e50d5ddf314a4e8f", "sha256": "dd72179249e6a156ae8f9d96dddf71dfcdd86a750469518a604e8e885f46bbd4" }, "downloads": -1, "filename": "doc_cli-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "b1d513be37a912e9e50d5ddf314a4e8f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 10771, "upload_time": "2019-10-01T03:55:47", "url": "https://files.pythonhosted.org/packages/bd/58/ca1981cd841e132cec8ea7cedcb0a16526cbe798aeb43fceea2e59ca9c9a/doc_cli-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b260bb5ebe6b9459b006bedfef5ace18", "sha256": "e558f08ff2538433b68d920f9a5a786f80873975603784f4dc3f0dfdac2d30ab" }, "downloads": -1, "filename": "doc-cli-0.0.4.tar.gz", "has_sig": false, "md5_digest": "b260bb5ebe6b9459b006bedfef5ace18", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 10137, "upload_time": "2019-10-01T03:55:45", "url": "https://files.pythonhosted.org/packages/c0/75/4d359fc90d9732817de4d27e8f1f3751ddd878fbebd27631403db5ebe6d7/doc-cli-0.0.4.tar.gz" } ] }