{ "info": { "author": "Quentin Le Baron", "author_email": "quentin.le-baron@epitech.eu", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.6" ], "description": "# agrparseGraph\n\n## Summary\n\n- [Description](#description)\n- [Install](#install)\n- [Use it](#user-it)\n- [Tests](#test)\n- [Documentation](#documentation)\n\n## Description\nAdd logic in argpars object with argparsGraph. \nThis package helps you to avoid the if/else forestswhen using `argparse`\n\n## Install\n\nInstall package:\n```shell\npip install argparse-graph\n```\n\nUninstall package:\n```shell\npip uninstall argparse-graph\n```\n\n**manually :**\n\nInstall the package:\n```shell\nmake install\n```\n\nUninstall the package:\n```shell\nmake uninstall\n```\n\n## Use it\n\n> The parameter defined with argparse must be named (dest=\"argsName\")if not, it will \n> be impossible to find some link between the variable name and the name in the yaml file.\n\nexample of argparse object:\n\n**python script**\n```python\nfrom argparseGraph.argparseGraph import argparseGraph as agg\n\ndef parsarg():\n parser = argparse.ArgumentParser(description=\"random options for differents cenarios\")\n parser.add_argument(\"-q\", dest=\"argv1\", help=\"test\", type=int)\n parser.add_argument(\"-w\", dest=\"argv2\", help=\"test\", type=int, action='append')\n parser.add_argument(\"-e\", dest=\"argv3\", help=\"test\", type=str, default=\"test3\")\n parser.add_argument(\"-t\", dest=\"argv4\", help=\"test\", type=str, default=False)\n parser.add_argument(\"-a\", dest=\"argv5\", help=\"test\", type=str)\n parser.add_argument(\"-s\", dest=\"argv6\", help=\"test\", type=bool)\n parser.add_argument(\"-d\", dest=\"argv7\", help=\"test\", type=str, action='append')\n args = parser.parse_args()\n\n return args\n\nres = parsarg()\nagg = agg(\"scenarios.yml\", res_args, verbose=False)\n```\n\n**scenario.yml**\n```yaml\n# if all parameters are not None\n# cmd: ./main.py -q 1 -w 1 -w 2 -e t -t o -a o -s t -d \"Hello\" -d \"World\"\nscenario_1:\n options: \"all\"\n# if argv3, argv4 are not None and other are None\n# format list [v1, v2]\n# cmd: ./main.py -e toto -t ok\nscenario_2:\n options: [argv3, argv4]\n# if argv3, argv4, argv5, argv6, argv7 are not None and other are None\n# format list \n# - argv3\n# - argv4\n# - argv5\n# - argv6\n# - argv7\n# cmd: ./main.py -e toto -t ok -a ok -s True -d \"Hello\" -d \"World\"\nscenario_3:\n options:\n - argv3\n - argv4\n - argv5\n - argv6\n - argv7\n# if argv3, argv4, argv6, argv7 are not None and other are None\n# format str argv3, argv4, argv6, argv7\n# cmd: ./main.py -s False -t True -d \"Test\"\nscenario_4:\n options: argv3, argv4, argv6, argv7\n```\n\nWith the `argparseGraph` object you can get 3 differents results formats,\nwith those methods: \n```python\n# Return the name of the strategie in the yaml file.\nagg.get_one()\n# example:\n# 'scenario_test'\n\n# Return a dict\nagg.get_dict()\n# { 'scenario': 'scenario_test', 'options': ['argv3', 'argv4', 'argv5', 'argv6', 'argv7'], 'status': None}\n\nagg.get_all()\n# {\n# 'scenario_1': {'options': 'all', 'name': 'scenario_1', 'status': 'Fail'},\n# 'scenario_2': {'options': ['argv3', 'argv4'], 'name': 'scenario_2', 'status': 'Fail'},\n# 'scenario_3': {'options': ['argv3', 'argv4'], 'name': 'scenario_3', 'status': 'Fail'},\n# 'scenario_4': {'options': ['argv3', 'argv4', 'argv6', 'argv7'], 'name': 'scenario_4', 'status': 'Fail'},\n# 'scenario_test': {'options': ['argv3', 'argv4', 'argv5', 'argv6', 'argv7'], 'name': 'scenario_test', 'status': None},\n# 'scenario_5': {'options': '', 'name': 'scenario_5', 'status': 'Fail'}\n# }\n```\n\n## Tests\n\nTwo types of tests are available, the first one is running on the sources in the project directory,\nthe second one is running on the package install on your system.\n\nrun test on the package not installed:\n```\nmake test\n```\n\nrun test on the package installed:\n```\nmake test_install\n```\n\n\n## Documentation\n\n_Makefile commands available_:\n\n| **Commands name** | **Description** |\n|:------------------------------------:|:------------------------------------- |\n| `make install` | install `argparseGraph` |\n| | |\n| `make uninstall` | uninstall `argparseGraph` |\n| | |\n| `make test` | run test on sources not installed |\n| | |\n| `make test_install` | run test on the package installed |\n| | |\n| `make run` | run example |\n| `make run scenarios=[1 , 2, 3, 4, 5]` | run example with a specifique scenarios|\n| | |\n\nyou can specify makefile options:\n\n| **Define name** | **Default** | **Description** |\n|:---------------------:|:----------- | ------------------------------------------- |\n| `EXEC_DEFAULT_TEST` | pytest | Tools to run tests |\n| | | |\n| `PYTHON_DEFAULT_EXEC` | python3 | Use Python to run tests and install package |\n| | | |\n\n\n**Credit Idea Gael Rottier**\n - [Medium](https://medium.com/@gaelrottier)\n - [Linkedin](https://www.linkedin.com/in/ga\u00ebl-rottier-53080263/)\n\n__Reference__:\n\n- [Python3.5 Documentation](https://www.python.org/downloads/release/python-350/)\n- [argparse (python3)](https://docs.python.org/3/library/argparse.html)\n- [pip](https://pip.pypa.io/en/stable/)\n- [setuptools](https://setuptools.readthedocs.io/en/latest/)", "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/kuty22/argparse_graph", "keywords": "", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "argparse-graph", "package_url": "https://pypi.org/project/argparse-graph/", "platform": "", "project_url": "https://pypi.org/project/argparse-graph/", "project_urls": { "Homepage": "https://github.com/kuty22/argparse_graph" }, "release_url": "https://pypi.org/project/argparse-graph/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "yaml file to add logique with argparse object.", "version": "0.1.1" }, "last_serial": 4984593, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "13efa008ab8a6d21e4fc1bcd65756c8b", "sha256": "d44eac378e624dac061bee9fded4537e49fad5cbbfa130e8a082073693c5464c" }, "downloads": -1, "filename": "argparse-graph-0.1.0.tar.gz", "has_sig": false, "md5_digest": "13efa008ab8a6d21e4fc1bcd65756c8b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4278, "upload_time": "2019-03-22T07:11:00", "url": "https://files.pythonhosted.org/packages/18/ba/3ad2e288654c985738c04e2a6f17e0b7edf65e85fc7d3846d9d2742955d1/argparse-graph-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "ad93fe732877d844ae3024c0b6f5406f", "sha256": "9cde707342211134a9b0d182518b771f64d9c587f8dcd04c1cd7f3f84ea740f5" }, "downloads": -1, "filename": "argparse-graph-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ad93fe732877d844ae3024c0b6f5406f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4792, "upload_time": "2019-03-23T07:47:26", "url": "https://files.pythonhosted.org/packages/dc/b2/ebbb3d3960a29d332606ddd8062abeeb6bbcc6e0429b6a49fcd3cf83cb57/argparse-graph-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ad93fe732877d844ae3024c0b6f5406f", "sha256": "9cde707342211134a9b0d182518b771f64d9c587f8dcd04c1cd7f3f84ea740f5" }, "downloads": -1, "filename": "argparse-graph-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ad93fe732877d844ae3024c0b6f5406f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4792, "upload_time": "2019-03-23T07:47:26", "url": "https://files.pythonhosted.org/packages/dc/b2/ebbb3d3960a29d332606ddd8062abeeb6bbcc6e0429b6a49fcd3cf83cb57/argparse-graph-0.1.1.tar.gz" } ] }