From 3eab15e1a385aa8fc3c64aff10c1949cdb9e0769 Mon Sep 17 00:00:00 2001 From: Zac Hatfield-Dodds Date: Fri, 25 Nov 2022 15:41:05 -0800 Subject: [PATCH] Use and test on new versions of Lark --- hypothesis-python/RELEASE.rst | 5 ++++ hypothesis-python/scripts/basic-test.sh | 7 +++-- hypothesis-python/setup.py | 2 +- .../src/hypothesis/extra/lark.py | 7 +---- hypothesis-python/tests/README.rst | 2 +- pytest.ini | 11 +++++--- requirements/coverage.in | 2 +- requirements/coverage.txt | 12 +++----- requirements/tools.in | 2 +- requirements/tools.txt | 28 +++++++++---------- 10 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 hypothesis-python/RELEASE.rst diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst new file mode 100644 index 0000000000..b63fc67c1f --- /dev/null +++ b/hypothesis-python/RELEASE.rst @@ -0,0 +1,5 @@ +RELEASE_TYPE: patch + +This patch shifts ``hypothesis[lark]`` from depending on the old :pypi:`lark-parser` +package to the new :pypi:`lark` package. There are no code changes in Hypothesis, +it's just that Lark got a new name on PyPI for version 1.0 onwards. diff --git a/hypothesis-python/scripts/basic-test.sh b/hypothesis-python/scripts/basic-test.sh index 8ad96b1f7f..cca73ccf63 100755 --- a/hypothesis-python/scripts/basic-test.sh +++ b/hypothesis-python/scripts/basic-test.sh @@ -39,10 +39,11 @@ if [ "$(python -c 'import sys; print(sys.version_info[:2] == (3, 7))')" = "False fi pip install ".[lark]" +pip install "$(grep -oE 'lark>=([0-9.]+)' ../hypothesis-python/setup.py | tr '>' =)" +$PYTEST -Wignore tests/lark/ +pip install "$(grep 'lark==' ../requirements/coverage.txt)" $PYTEST tests/lark/ -pip install "$(grep 'lark-parser==' ../requirements/coverage.txt)" -$PYTEST tests/lark/ -pip uninstall -y lark-parser +pip uninstall -y lark if [ "$(python -c $'import platform, sys; print(sys.version_info.releaselevel == \'final\' and platform.python_implementation() != "PyPy")')" = "True" ] ; then pip install ".[codemods,cli]" diff --git a/hypothesis-python/setup.py b/hypothesis-python/setup.py index 62b5180018..cdca6f41d0 100644 --- a/hypothesis-python/setup.py +++ b/hypothesis-python/setup.py @@ -57,7 +57,7 @@ def local_file(name): "ghostwriter": ["black>=19.10b0"], "pytz": ["pytz>=2014.1"], "dateutil": ["python-dateutil>=1.4"], - "lark": ["lark-parser>=0.6.5"], + "lark": ["lark>=0.10.1"], # probably still works with old `lark-parser` too "numpy": ["numpy>=1.9.0"], "pandas": ["pandas>=1.0"], "pytest": ["pytest>=4.6"], diff --git a/hypothesis-python/src/hypothesis/extra/lark.py b/hypothesis-python/src/hypothesis/extra/lark.py index 127604b8e4..6320115661 100644 --- a/hypothesis-python/src/hypothesis/extra/lark.py +++ b/hypothesis-python/src/hypothesis/extra/lark.py @@ -22,11 +22,6 @@ `_ from `nearley.js `_, so you may not have to write your own at all. - -Note that as Lark is at version 0.x, this module *may* break API compatibility -in minor releases if supporting the latest version of Lark would otherwise be -infeasible. We may also be quite aggressive in bumping the minimum version of -Lark, unless someone volunteers to either fund or do the maintenance. """ from inspect import signature @@ -34,7 +29,7 @@ import attr import lark -from lark.grammar import NonTerminal, Terminal # type: ignore +from lark.grammar import NonTerminal, Terminal from hypothesis import strategies as st from hypothesis.errors import InvalidArgument diff --git a/hypothesis-python/tests/README.rst b/hypothesis-python/tests/README.rst index 500f042eb9..496a98bb74 100644 --- a/hypothesis-python/tests/README.rst +++ b/hypothesis-python/tests/README.rst @@ -89,7 +89,7 @@ Still here? Here's a note on what to expect in each directory. ``lark/`` Tests for the Lark extra for context-free grammars, which depend on the - ``lark-parser`` package. + ``lark`` package. ``nocover/`` More expensive and longer-running tests, typically used to test trickier diff --git a/pytest.ini b/pytest.ini index eaf26d5820..25fbfae21d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,7 +1,13 @@ [pytest] # -rfEX :: Print a summary of failures, errors, and xpasses (xfails that pass). -addopts=--strict-markers --tb=native -p pytester --runpytest=subprocess --durations=20 -rfEX +addopts = + -rfEX + --strict-markers + --tb=native + -p pytester + --runpytest=subprocess + --durations=20 xfail_strict = True filterwarnings = error @@ -11,9 +17,6 @@ filterwarnings = default:distutils Version classes are deprecated\. Use packaging\.version instead:DeprecationWarning # https://github.com/pandas-dev/pandas/issues/32056 (?) default:numpy\.ufunc size changed, may indicate binary incompatibility\. Expected 216 from C header, got 232 from PyObject:RuntimeWarning - # https://github.com/lark-parser/lark/pull/1140 - default:module 'sre_constants' is deprecated:DeprecationWarning - default:module 'sre_parse' is deprecated:DeprecationWarning # https://github.com/pandas-dev/pandas/issues/34848 default:`np\.bool` is a deprecated alias for the builtin `bool`:DeprecationWarning default:`np\.complex` is a deprecated alias for the builtin `complex`:DeprecationWarning diff --git a/requirements/coverage.in b/requirements/coverage.in index c196eba125..1547b8dca2 100644 --- a/requirements/coverage.in +++ b/requirements/coverage.in @@ -4,7 +4,7 @@ click coverage dpcontracts fakeredis -lark-parser +lark libcst numpy pandas diff --git a/requirements/coverage.txt b/requirements/coverage.txt index 08f13dbf91..dd49ac09ec 100644 --- a/requirements/coverage.txt +++ b/requirements/coverage.txt @@ -20,8 +20,6 @@ click==8.1.3 # black coverage==6.5.0 # via -r requirements/coverage.in -deprecated==1.2.13 - # via redis dpcontracts==0.6.0 # via -r requirements/coverage.in exceptiongroup==1.0.4 ; python_version < "3.11" @@ -34,7 +32,7 @@ fakeredis==2.0.0 # via -r requirements/coverage.in iniconfig==1.1.1 # via pytest -lark-parser==0.12.0 +lark==1.1.4 # via -r requirements/coverage.in libcst==0.4.9 # via -r requirements/coverage.in @@ -42,7 +40,7 @@ mypy-extensions==0.4.3 # via # black # typing-inspect -numpy==1.23.4 +numpy==1.23.5 # via # -r requirements/coverage.in # pandas @@ -50,7 +48,7 @@ packaging==21.3 # via # pytest # redis -pandas==1.5.1 +pandas==1.5.2 # via -r requirements/coverage.in pathspec==0.10.2 # via black @@ -80,7 +78,7 @@ pytz==2022.6 # pandas pyyaml==6.0 # via libcst -redis==4.3.4 +redis==4.3.5 # via fakeredis six==1.16.0 # via python-dateutil @@ -100,5 +98,3 @@ typing-extensions==4.4.0 # typing-inspect typing-inspect==0.8.0 # via libcst -wrapt==1.14.1 - # via deprecated diff --git a/requirements/tools.in b/requirements/tools.in index 3003c4cc85..7dc9d83709 100644 --- a/requirements/tools.in +++ b/requirements/tools.in @@ -18,7 +18,7 @@ flake8-return flake8-simplify # flake8-strftime # See https://github.com/python-formate/flake8_strftime/issues/47 ipython -lark-parser +lark libcst mypy pip-tools diff --git a/requirements/tools.txt b/requirements/tools.txt index 3fb57ea7a2..36f2caefa8 100644 --- a/requirements/tools.txt +++ b/requirements/tools.txt @@ -17,7 +17,7 @@ attrs==22.1.0 # flake8-bugbear # hypothesis (hypothesis-python/setup.py) # pytest -autoflake==1.7.7 +autoflake==2.0.0 # via shed babel==2.11.0 # via sphinx @@ -79,7 +79,7 @@ filelock==3.8.0 # via # tox # virtualenv -flake8==5.0.4 +flake8==6.0.0 # via # -r requirements/tools.in # flake8-2020 @@ -108,7 +108,7 @@ flake8-docstrings==1.6.0 # via -r requirements/tools.in flake8-mutable==1.2.0 # via -r requirements/tools.in -flake8-noqa==1.2.9 +flake8-noqa==1.3.0 # via -r requirements/tools.in flake8-pie==0.16.0 # via -r requirements/tools.in @@ -122,7 +122,7 @@ flake8-return==1.2.0 # via -r requirements/tools.in flake8-simplify==0.19.3 # via -r requirements/tools.in -gitdb==4.0.9 +gitdb==4.0.10 # via gitpython gitpython==3.1.29 # via bandit @@ -130,7 +130,7 @@ idna==3.4 # via requests imagesize==1.4.1 # via sphinx -importlib-metadata==5.0.0 +importlib-metadata==5.1.0 # via # keyring # sphinx @@ -143,7 +143,7 @@ isort==5.10.1 # via shed jaraco-classes==3.2.3 # via keyring -jedi==0.18.1 +jedi==0.18.2 # via ipython jeepney==0.8.0 # via @@ -153,7 +153,7 @@ jinja2==3.1.2 # via sphinx keyring==23.11.0 # via twine -lark-parser==0.12.0 +lark==1.1.4 # via -r requirements/tools.in libcst==0.4.9 # via @@ -206,7 +206,7 @@ pluggy==1.0.0 # via # pytest # tox -prompt-toolkit==3.0.32 +prompt-toolkit==3.0.33 # via ipython ptyprocess==0.7.0 # via pexpect @@ -214,13 +214,13 @@ pure-eval==0.2.2 # via stack-data py==1.11.0 # via tox -pycodestyle==2.9.1 +pycodestyle==2.10.0 # via flake8 pycparser==2.21 # via cffi pydocstyle==6.1.1 # via flake8-docstrings -pyflakes==2.5.0 +pyflakes==3.0.1 # via # autoflake # flake8 @@ -232,7 +232,7 @@ pygments==2.13.0 # sphinx pyparsing==3.0.9 # via packaging -pyright==1.1.280 +pyright==1.1.281 # via -r requirements/tools.in pytest==7.2.0 # via -r requirements/tools.in @@ -341,7 +341,7 @@ types-pkg-resources==0.1.3 # via -r requirements/tools.in types-pytz==2022.6.0.1 # via -r requirements/tools.in -types-redis==4.3.21.4 +types-redis==4.3.21.5 # via -r requirements/tools.in typing-extensions==4.4.0 # via @@ -355,7 +355,7 @@ typing-extensions==4.4.0 # typing-inspect typing-inspect==0.8.0 # via libcst -urllib3==1.26.12 +urllib3==1.26.13 # via # requests # twine @@ -367,7 +367,7 @@ webencodings==0.5.1 # via bleach wheel==0.38.4 # via pip-tools -zipp==3.10.0 +zipp==3.11.0 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: