From ef1d021024b2d54d80205c79e8985476c262769c Mon Sep 17 00:00:00 2001 From: buhl <221842+buhl@users.noreply.github.com> Date: Tue, 21 Apr 2020 17:16:34 +0200 Subject: [PATCH] Added the regex pypi package as an extras_require --- .travis.yml | 2 ++ parsimonious/expressions.py | 6 +++++- setup.py | 3 +++ tox.ini | 3 ++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e24ec2a..a9b4e59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,8 @@ python: - "3.4" - "3.5" - "3.6" + - "3.7" + - "3.8" install: - pip install tox tox-travis script: diff --git a/parsimonious/expressions.py b/parsimonious/expressions.py index c2bf140..256ecec 100644 --- a/parsimonious/expressions.py +++ b/parsimonious/expressions.py @@ -7,7 +7,11 @@ # anything--for speed. And kill all the dots. from inspect import getargspec -import re + +try: + import regex as re +except ImportError: + import re from six import integer_types, python_2_unicode_compatible from six.moves import range diff --git a/setup.py b/setup.py index e7697ef..dd0d590 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,9 @@ url='https://github.com/erikrose/parsimonious', include_package_data=True, install_requires=['six>=1.9.0'], + extras_require={ + "regex": ["regex>=2020.04.04"], + }, classifiers=[ 'Intended Audience :: Developers', 'Natural Language :: English', diff --git a/tox.ini b/tox.ini index 793084b..c910959 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27, py34, py35, py36 +envlist = py27, py34, py35, py36, py37, py38, py{27, 34, 35, 36, 37, 38}--regex [tox:travis] 2.7 = py27 @@ -13,3 +13,4 @@ commands = nosetests parsimonious deps = nose six>=1.9.0 + regex: regex