{ "info": { "author": "pyLHC", "author_email": "pylhc@github.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6" ], "description": "# Generic Parser\n[![Travis (.com)](https://img.shields.io/travis/com/pylhc/generic_parser.svg?style=popout)](https://travis-ci.com/pylhc/generic_parser/)\n[![Code Climate coverage](https://img.shields.io/codeclimate/coverage/pylhc/generic_parser.svg?style=popout)](https://codeclimate.com/github/pylhc/generic_parser)\n[![Code Climate maintainability (percentage)](https://img.shields.io/codeclimate/maintainability-percentage/pylhc/generic_parser.svg?style=popout)](https://codeclimate.com/github/pylhc/generic_parser)\n[![GitHub last commit](https://img.shields.io/github/last-commit/pylhc/generic_parser.svg?style=popout)](https://github.com/pylhc/generic_parser/)\n[![GitHub release](https://img.shields.io/github/release/pylhc/generic_parser.svg?style=popout)](https://github.com/pylhc/generic_parser/)\n\nA parser for arguments and config-files that also allows direct python input.\n\n## Getting Started\n\n### Installing\n\nInstallation is easily done via `pip`. The package is then used as `generic_parser`.\n\n```\npip install generic-parser\n```\n\n### Example Usage:\n\nContent of `myscript.py`\n```python\nfrom generic_parser import entrypoint, EntryPointParameters\n\n\ndef get_arguments():\n args = EntryPointParameters()\n args.add_parameter(name=\"first\",\n flags=[\"-f\", \"--first\"],\n help=\"First Parameter, an int\",\n choices=[1, 2, 3],\n type=int,\n required=True,\n )\n args.add_parameter(name=\"second\",\n flags=[\"-s\", \"--second\"],\n help=\"Second Parameter, a string\",\n type=str,\n default=\"default\",\n required=False,\n )\n return args\n\n\n@entrypoint(get_arguments())\ndef main(opt, unknown):\n print(opt.first == 1)\n print(opt.second == \"default\")\n\n\nif __name__ == '__main__':\n main()\n```\n\n#### Commandline\nCalling that script with ``python myscript.py -f 1 -s \"test\"`` will result in \n```\nTrue\nFalse\n```\n\nIt is assumed, that this is the standard mode of operation for your functions.\n\n#### Config File\nFurther, one can also use a config file `config.ini` containing:\n```\n[Section]\nfirst = 2\nsecond = \"Hello\"\n```\nand run the script with `python myscript.py --entry_cfg config.ini` leading to\n```\nFalse\nFalse\n```\n\nConfig files are very useful if you want to rerun your code with the same or similar parameters.\nEspecially the declaration of a `[DEFAULT]` section can be helpful.\nFor further information about config files, check the python\n[Config Parser](https://docs.python.org/3/library/configparser.html).\n\n\n#### Python\nOr call the function directly from python code\n\n```python\nif __name__ == '__main__':\n main(first=1, second=\"World\") \n```\n\n```\nTrue\nFalse\n```\n\nThis is incredibly helpful if one wants to write python-wrappers around entrypoint-functions, \nand does not want to resort to commandline calls from python.\n\nNote that also in this case all variables are validated, courtesy of the `dict_parser`.\n`dict_parser` provides even multi-level dictionary checking functionality, \nwhich is not used in the `Entrypoint`, but can be handy in other use-cases.\n\n## Description\n\nThe package provides an all-around parser for arguments and config-files.\nThe creation of the arguments is similar to the ones from argparse, but the input\ncan then be either from command line, a config file or directly from python.\n\nFor a detailed description check [the documentation](https://pylhc.github.io/generic_parser).\n\n\n## Authors\n\n* **Josch** - [JoschD](https://github.com/JoschD)\n* **pyLHC/OMC-Team** - *Working Group* - [pyLHC](https://github.com/orgs/pylhc/teams/omc-team)\n\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n\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/pylhc/generic_parser", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "generic-parser", "package_url": "https://pypi.org/project/generic-parser/", "platform": "", "project_url": "https://pypi.org/project/generic-parser/", "project_urls": { "Homepage": "https://github.com/pylhc/generic_parser" }, "release_url": "https://pypi.org/project/generic-parser/1.0.5/", "requires_dist": null, "requires_python": "", "summary": "A parser for arguments and config-files that also allows direct python input.", "version": "1.0.5" }, "last_serial": 5976811, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "771b2d95cd18f0a658996abb7f90fbf4", "sha256": "adefbce258d6b1753db7d582f7aa6b6951b46d3656d35483be0fb0c7a9fd7a9f" }, "downloads": -1, "filename": "generic_parser-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "771b2d95cd18f0a658996abb7f90fbf4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17601, "upload_time": "2019-08-08T14:25:49", "url": "https://files.pythonhosted.org/packages/61/5b/f84b7fde3f904bed34c25a6756e2e8bf79377fc7ca3240afde107a5714b2/generic_parser-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ff0c2fbd2af1bb944647aa9866a99122", "sha256": "0755ee43911bdb1d0e5d2815363cca6a073d33868e8fed22cc7eeed8b0a0e462" }, "downloads": -1, "filename": "generic-parser-1.0.0.tar.gz", "has_sig": false, "md5_digest": "ff0c2fbd2af1bb944647aa9866a99122", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16447, "upload_time": "2019-08-08T14:25:51", "url": "https://files.pythonhosted.org/packages/c6/51/469bce8091d4eb236f0ebd025fc4496b01e63d29df56b631febf2a5e4059/generic-parser-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "f974dc06494fe379e92f63d1b9416d77", "sha256": "bcb28d83929501669591dedced7adaa5e6de4a4380223f4e136d3be72b0bafb6" }, "downloads": -1, "filename": "generic_parser-1.0.1-py3.7.egg", "has_sig": false, "md5_digest": "f974dc06494fe379e92f63d1b9416d77", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": null, "size": 36870, "upload_time": "2019-08-08T15:09:49", "url": "https://files.pythonhosted.org/packages/79/27/55cbfc3248ee701731777368cb59b4562514baebfc23619311523a73e4e1/generic_parser-1.0.1-py3.7.egg" }, { "comment_text": "", "digests": { "md5": "e5ff00f470c5e3e06872eeb99e827ddc", "sha256": "8250faaad723fd28177b5d3cb73f9222ecee4eeabaa9c6ca2d1da540858fd4af" }, "downloads": -1, "filename": "generic_parser-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e5ff00f470c5e3e06872eeb99e827ddc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17608, "upload_time": "2019-08-08T14:33:31", "url": "https://files.pythonhosted.org/packages/92/7f/849c636039e867814325b15028d8fead2104d5e4049b756f7db4b14485ec/generic_parser-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ecbdb00f57b4d4d1af8f9b62d77163ae", "sha256": "1b958e4b707080a2a7f6bbfbd54e2cddc7c51b8874145052ff6cd92e91718a12" }, "downloads": -1, "filename": "generic-parser-1.0.1.tar.gz", "has_sig": false, "md5_digest": "ecbdb00f57b4d4d1af8f9b62d77163ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16455, "upload_time": "2019-08-08T14:33:33", "url": "https://files.pythonhosted.org/packages/a8/89/6c52870aa0c5465872e43e931a6c2179ea6ea9a86d703489a3cccd6e8df5/generic-parser-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "794a7c20089b0ad6d095aa610ec79dac", "sha256": "04b52a6227efb050f7a168f0d77881d48a60041e73a3ecb14da24b81b8354464" }, "downloads": -1, "filename": "generic_parser-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "794a7c20089b0ad6d095aa610ec79dac", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17620, "upload_time": "2019-08-08T15:09:47", "url": "https://files.pythonhosted.org/packages/9e/75/a18bd8a71b7e931fe0ce3a48a9781a79526636c694f8b3af70dc1abb7368/generic_parser-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ba8d56326d31206738ad6d5245a3c16c", "sha256": "99dae6220eea83cd8cff7e84d8d3e95415a2db634f3ebff96d6755da512ce5bb" }, "downloads": -1, "filename": "generic-parser-1.0.2.tar.gz", "has_sig": false, "md5_digest": "ba8d56326d31206738ad6d5245a3c16c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16470, "upload_time": "2019-08-08T15:09:51", "url": "https://files.pythonhosted.org/packages/65/65/1c77b113a4192930e0dbe4238b3b8e4cea78c5b7767ea19b27940a0a9d1d/generic-parser-1.0.2.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "a6b014ebcb67a64737585734ec33d112", "sha256": "0d39b70781965fece1f39cf430a494c3deaa69fe773fe9d7128017cee343a01c" }, "downloads": -1, "filename": "generic_parser-1.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "a6b014ebcb67a64737585734ec33d112", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17682, "upload_time": "2019-10-11T15:35:39", "url": "https://files.pythonhosted.org/packages/97/4b/0ecab3daa0307d4f93636bb29ff124f0e469ec420ea5868899fc02435db9/generic_parser-1.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fd18c583c2f2f12c1e0a4563a26f51e9", "sha256": "49740f03cccf88cecc16a9add22e2f8c7c81bbd8d67b154f715b0139bc723950" }, "downloads": -1, "filename": "generic-parser-1.0.4.tar.gz", "has_sig": false, "md5_digest": "fd18c583c2f2f12c1e0a4563a26f51e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16592, "upload_time": "2019-10-11T15:35:41", "url": "https://files.pythonhosted.org/packages/b5/27/748c9a5606258e0ccc4b6d514f5170597b53a53c41ba65e4cdd2756d2c4c/generic-parser-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "31eb30762b905c1b75e919aec9a56612", "sha256": "c5c4042f59e52ae4abd8fadad1057550ada2d0c00b894910f06e62ed21ede4b4" }, "downloads": -1, "filename": "generic_parser-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "31eb30762b905c1b75e919aec9a56612", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17680, "upload_time": "2019-10-15T12:55:09", "url": "https://files.pythonhosted.org/packages/ed/68/2931986fdfca01ef3aa48a90cc61e35d60c52d1e3710e1e6f7ebcecaca72/generic_parser-1.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7d165d57c7f5a86f4061725352c21d81", "sha256": "14b345551c3d66a126263763163998a692e7100820eb546fa915da179f636b53" }, "downloads": -1, "filename": "generic-parser-1.0.5.tar.gz", "has_sig": false, "md5_digest": "7d165d57c7f5a86f4061725352c21d81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15101, "upload_time": "2019-10-15T12:55:11", "url": "https://files.pythonhosted.org/packages/2c/77/a2c7d26533c4d5266ce983a2531654ca9b6bc888233a672c6c07bd07ec6a/generic-parser-1.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "31eb30762b905c1b75e919aec9a56612", "sha256": "c5c4042f59e52ae4abd8fadad1057550ada2d0c00b894910f06e62ed21ede4b4" }, "downloads": -1, "filename": "generic_parser-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "31eb30762b905c1b75e919aec9a56612", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17680, "upload_time": "2019-10-15T12:55:09", "url": "https://files.pythonhosted.org/packages/ed/68/2931986fdfca01ef3aa48a90cc61e35d60c52d1e3710e1e6f7ebcecaca72/generic_parser-1.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7d165d57c7f5a86f4061725352c21d81", "sha256": "14b345551c3d66a126263763163998a692e7100820eb546fa915da179f636b53" }, "downloads": -1, "filename": "generic-parser-1.0.5.tar.gz", "has_sig": false, "md5_digest": "7d165d57c7f5a86f4061725352c21d81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15101, "upload_time": "2019-10-15T12:55:11", "url": "https://files.pythonhosted.org/packages/2c/77/a2c7d26533c4d5266ce983a2531654ca9b6bc888233a672c6c07bd07ec6a/generic-parser-1.0.5.tar.gz" } ] }