{ "info": { "author": "Gianluca Gippetto", "author_email": "gianluca.gippetto@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Utilities" ], "description": "========\nOverview\n========\n\n\n\n\nThe goal of ``reagex`` (from `\"readable regular expression\"`)\nis to suggest a way for writing complex regular expressions with\nmany capturing groups in a readable way.\n\nAt the moment, it contains just one very simple function\n(called ``reagex``) and an utility function, but any function\nwhich could be useful for writing readable patterns is welcome.\n\n**Note:** Publishing this ridiculously small project is an excuse to familiarize\nwith python packaging, DevOps tools and the entire workflow behind the publication\nof an open-source project.\nThe project template was generated using https://github.com/ionelmc/cookiecutter-pylibrary/\nwhich is obviously an overkill for a \"one-function-project\".\n\n* Free software: BSD 2-Clause License\n\nUsage\n=====\nThe core function ``reagex`` is just a wrapper of ``str.format`` and it works\nin the same way. See the example\n\n.. code-block:: python\n\n import re\n from reagex import reagex\n\n # A sloppy pattern for an italian address (just to show how it works)\n pattern = reagex(\n '{_address}, {postcode} {city} {province}',\n # groups starting with \"_\" are non-capturing\n _address = reagex(\n '{street} {number}',\n street = '(via|contrada|c/da|c[.]da|piazza|p[.]za|p[.]zza) [a-zA-Z]+',\n number = 'snc|[0-9]+'\n ),\n postcode = '[0-9]{5}',\n city = '[A-Za-z]+',\n province = '[A-Z]{2}'\n )\n\n matcher = re.compile(pattern)\n match = matcher.fullmatch('via Roma 123, 12345 Napoli NA')\n print(match.groupdict())\n\n # prints:\n # {'city': 'Napoli',\n # 'number': '123',\n # 'postcode': '12345',\n # 'province': 'NA',\n # 'street': 'via Roma'}\n\n\nGroups starting by ``'_'`` are non-capturing. The rest are all named capturing\ngroups.\n\nWhy not...\n===========\nWhy not using just re.VERBOSE?\n------------------------------\nI think ``reagex`` is easier to write and to read:\n\n* with reagex, you first describe the structure of the pattern in terms of groups,\n `then` you provide a pattern for each group;\n with re.VERBOSE you have to define the groups in the exact position they\n must be matched: to get the high-level structure of the pattern you may need\n to read multiple lines at the same indentation level\n* with re.VERBOSE you just write a big string; with reagex you get\n syntax highlighting which helps readability\n* white-spaces don't need any special treatment\n* \"{group_name}\" is nicer than \"(?P)\"\n\n\nInstallation\n============\n::\n\n pip install reagex\n\n\nDocumentation\n=============\n\nhttps://python-reagex.readthedocs.io/\n\n\nDevelopment\n===========\nPossible improvements:\n\n1. make some meaningful use of the ``format_spec``\n in ``{group_name:format_spec}``\n\n2. add utility functions like ``repeated`` to help writing\n common patterns in a readable way\n\n\nTesting\n-------\nTo run all the tests::\n\n tox\n\nNote, to combine the coverage data from all the tox environments run:\n\n.. list-table::\n :widths: 10 90\n :stub-columns: 1\n\n - - Windows\n - ::\n\n set PYTEST_ADDOPTS=--cov-append\n tox\n\n - - Other\n - ::\n\n PYTEST_ADDOPTS=--cov-append tox\n\n\nChangelog\n=========\n\n0.1.2 (2018-12-16)\n------------------\n* Fix little mistake in the example (which is showed in PyPI, so a release\n was necessary to update the PyPI page).\n\n\n0.1.1 (2018-12-12)\n------------------\n* Minor fixes and modifications to documentation\n\n\n0.1.0 (2018-12-08)\n------------------\n* First release on PyPI.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/janluke/python-reagex", "keywords": "regular-expression,regex,pattern,readable,readability", "license": "BSD 2-Clause License", "maintainer": "", "maintainer_email": "", "name": "reagex", "package_url": "https://pypi.org/project/reagex/", "platform": "", "project_url": "https://pypi.org/project/reagex/", "project_urls": { "Homepage": "https://github.com/janluke/python-reagex" }, "release_url": "https://pypi.org/project/reagex/0.1.2/", "requires_dist": null, "requires_python": "", "summary": "Utility functions for writing readable regular expressions in a hierarchical way", "version": "0.1.2" }, "last_serial": 4604955, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "962b16e2974824d9fd0e0d04e9850c7d", "sha256": "07f6c26137f3323499148d4f1e2e9de4fd573d5e1172d0ed607a073e77db6aba" }, "downloads": -1, "filename": "reagex-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "962b16e2974824d9fd0e0d04e9850c7d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5465, "upload_time": "2018-12-08T19:52:20", "url": "https://files.pythonhosted.org/packages/fa/e0/d60076906fbaf02a3fe05bf8730c4246af4a325c5bfe3c56b6645f133b93/reagex-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a163a8f41a25e33c6437aef2a5cf5c95", "sha256": "77b07b8902333db873b570d54243dd8674a84c6b4e25605b0fc8cc81dac5b9a0" }, "downloads": -1, "filename": "reagex-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a163a8f41a25e33c6437aef2a5cf5c95", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18520, "upload_time": "2018-12-08T19:52:22", "url": "https://files.pythonhosted.org/packages/f5/8c/2a6c5cc8c58f12ede58a3a052e1065611c8259100938efb8f0c19f3057e9/reagex-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "68c24f252a2944cdf6019335e3d57291", "sha256": "82b1c2a87f376a43e3dc9abaabb433485391b10c25533f2c4e10682cecf167e2" }, "downloads": -1, "filename": "reagex-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "68c24f252a2944cdf6019335e3d57291", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5496, "upload_time": "2018-12-12T13:20:31", "url": "https://files.pythonhosted.org/packages/47/5a/8ed2969e9e77ef7a533ff62501938319ca33031038d76ca74bad0e3d4332/reagex-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "60a18ba3ea9edb6de986b9b32f6b3341", "sha256": "893aee0965292394d76c0120f5c13caf9b896651a0378f0a9eba7b05cd43cc6d" }, "downloads": -1, "filename": "reagex-0.1.1.tar.gz", "has_sig": false, "md5_digest": "60a18ba3ea9edb6de986b9b32f6b3341", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18596, "upload_time": "2018-12-12T13:20:33", "url": "https://files.pythonhosted.org/packages/96/ac/00537dd562162029d3535bdcfdec4fed969a35df99efe56f43231e60f4e2/reagex-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "e3fbbfe6408d518135079afd636146b6", "sha256": "44edb7325d04ede2889b2b64c80a06254bd75d24038868561c63b428ea5070b4" }, "downloads": -1, "filename": "reagex-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e3fbbfe6408d518135079afd636146b6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5599, "upload_time": "2018-12-16T15:37:06", "url": "https://files.pythonhosted.org/packages/e4/f9/996cb53eee8082620b6184c3de91af56bc5e16919ca0229de481c86d2a01/reagex-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b28e0730dd5540b43d407a94492d11d9", "sha256": "8d820d3b0bf2cc6fc14081d66d5deeff7a2cdd38a98851af04094f68fa2bdeaa" }, "downloads": -1, "filename": "reagex-0.1.2.tar.gz", "has_sig": false, "md5_digest": "b28e0730dd5540b43d407a94492d11d9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18828, "upload_time": "2018-12-16T15:37:08", "url": "https://files.pythonhosted.org/packages/53/43/a02d3cf3f02b967c83ce8928fa463f6430fa4afff812a523fdf158422b54/reagex-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e3fbbfe6408d518135079afd636146b6", "sha256": "44edb7325d04ede2889b2b64c80a06254bd75d24038868561c63b428ea5070b4" }, "downloads": -1, "filename": "reagex-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e3fbbfe6408d518135079afd636146b6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5599, "upload_time": "2018-12-16T15:37:06", "url": "https://files.pythonhosted.org/packages/e4/f9/996cb53eee8082620b6184c3de91af56bc5e16919ca0229de481c86d2a01/reagex-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b28e0730dd5540b43d407a94492d11d9", "sha256": "8d820d3b0bf2cc6fc14081d66d5deeff7a2cdd38a98851af04094f68fa2bdeaa" }, "downloads": -1, "filename": "reagex-0.1.2.tar.gz", "has_sig": false, "md5_digest": "b28e0730dd5540b43d407a94492d11d9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18828, "upload_time": "2018-12-16T15:37:08", "url": "https://files.pythonhosted.org/packages/53/43/a02d3cf3f02b967c83ce8928fa463f6430fa4afff812a523fdf158422b54/reagex-0.1.2.tar.gz" } ] }