Skip to content

Commit

Permalink
Merge pull request #3514 from Zac-HD/update-lark
Browse files Browse the repository at this point in the history
Use and test on new versions of Lark
  • Loading branch information
Zac-HD authored Nov 26, 2022
2 parents a38276a + 3eab15e commit cca8506
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 39 deletions.
5 changes: 5 additions & 0 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 4 additions & 3 deletions hypothesis-python/scripts/basic-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
7 changes: 1 addition & 6 deletions hypothesis-python/src/hypothesis/extra/lark.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,14 @@
<https://lark-parser.readthedocs.io/en/latest/nearley.html>`_
from `nearley.js <https://nearley.js.org/>`_, 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
from typing import Dict, Optional

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
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/coverage.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ click
coverage
dpcontracts
fakeredis
lark-parser
lark
libcst
numpy
pandas
Expand Down
12 changes: 4 additions & 8 deletions requirements/coverage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -34,23 +32,23 @@ 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
mypy-extensions==0.4.3
# via
# black
# typing-inspect
numpy==1.23.4
numpy==1.23.5
# via
# -r requirements/coverage.in
# pandas
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
Expand Down Expand Up @@ -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
Expand All @@ -100,5 +98,3 @@ typing-extensions==4.4.0
# typing-inspect
typing-inspect==0.8.0
# via libcst
wrapt==1.14.1
# via deprecated
2 changes: 1 addition & 1 deletion requirements/tools.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions requirements/tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -122,15 +122,15 @@ 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
idna==3.4
# via requests
imagesize==1.4.1
# via sphinx
importlib-metadata==5.0.0
importlib-metadata==5.1.0
# via
# keyring
# sphinx
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -206,21 +206,21 @@ 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
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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit cca8506

Please sign in to comment.