diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ddbad0..d339bbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,9 +10,9 @@ jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python 3.8 - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: 3.8 - name: Install dependencies @@ -28,12 +28,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"] fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -48,9 +48,9 @@ jobs: needs: [check, test] if: github.repository == 'Zac-HD/hypothesmith' && github.ref == 'refs/heads/master' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python 3.8 - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: 3.8 - name: Install tools diff --git a/CHANGELOG.md b/CHANGELOG.md index 97f0b14..01fa84f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 0.3.3 - 2024-02-16 +- Add Python 3.12 and 3.13 to CI +- Can now be imported on Python 3.13 + ### 0.3.2 - 2024-01-13 - Performance improvements based on [Hypothesis 6.93.0](https://hypothesis.readthedocs.io/en/latest/changes.html#v6-93-0) diff --git a/deps/check.txt b/deps/check.txt index eeb656b..5662214 100644 --- a/deps/check.txt +++ b/deps/check.txt @@ -10,9 +10,9 @@ attrs==23.2.0 # hypothesis autoflake==2.2.1 # via shed -bandit==1.7.6 +bandit==1.7.7 # via flake8-bandit -black==23.12.1 +black==24.2.0 # via shed click==8.1.7 # via black @@ -29,17 +29,13 @@ flake8==7.0.0 # flake8-docstrings flake8-bandit==4.1.1 # via -r deps/check.in -flake8-bugbear==23.12.2 +flake8-bugbear==24.2.6 # via -r deps/check.in flake8-comprehensions==3.14.0 # via -r deps/check.in flake8-docstrings==1.7.0 # via -r deps/check.in -gitdb==4.0.11 - # via gitpython -gitpython==3.1.41 - # via bandit -hypothesis==6.93.0 +hypothesis==6.98.6 # via -r deps/check.in isort==5.13.2 # via shed @@ -64,7 +60,7 @@ pathspec==0.12.1 # via black pbr==6.0.0 # via stevedore -platformdirs==4.1.0 +platformdirs==4.2.0 # via black pycodestyle==2.11.1 # via flake8 @@ -84,10 +80,8 @@ pyyaml==6.0.1 # libcst rich==13.7.0 # via bandit -shed==2023.6.1 +shed==2024.1.1 # via -r deps/check.in -smmap==5.0.1 - # via gitdb snowballstemmer==2.2.0 # via pydocstyle sortedcontainers==2.4.0 diff --git a/deps/test.txt b/deps/test.txt index 66cc169..a41bd55 100644 --- a/deps/test.txt +++ b/deps/test.txt @@ -6,11 +6,11 @@ # attrs==23.2.0 # via hypothesis -black==23.12.1 +black==24.2.0 # via -r deps/test.in click==8.1.7 # via black -coverage[toml]==7.4.0 +coverage[toml]==7.4.1 # via pytest-cov exceptiongroup==1.2.0 # via @@ -18,7 +18,7 @@ exceptiongroup==1.2.0 # pytest execnet==2.0.2 # via pytest-xdist -hypothesis[lark]==6.93.0 +hypothesis[lark]==6.98.6 # via hypothesmith (setup.py) iniconfig==2.0.0 # via pytest @@ -38,11 +38,11 @@ parso==0.8.3 # via -r deps/test.in pathspec==0.12.1 # via black -platformdirs==4.1.0 +platformdirs==4.2.0 # via black -pluggy==1.3.0 +pluggy==1.4.0 # via pytest -pytest==7.4.4 +pytest==8.0.0 # via # -r deps/test.in # pytest-cov diff --git a/setup.py b/setup.py index 4fda72d..c4c81c4 100644 --- a/setup.py +++ b/setup.py @@ -45,6 +45,7 @@ def local_file(name: str) -> str: "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Software Development :: Testing", ], long_description=open(README).read(), diff --git a/src/hypothesmith/__init__.py b/src/hypothesmith/__init__.py index 6170bd7..2ab6cde 100644 --- a/src/hypothesmith/__init__.py +++ b/src/hypothesmith/__init__.py @@ -3,5 +3,5 @@ from hypothesmith.cst import from_node from hypothesmith.syntactic import from_grammar -__version__ = "0.3.2" +__version__ = "0.3.3" __all__ = ["from_grammar", "from_node"] diff --git a/src/hypothesmith/syntactic.py b/src/hypothesmith/syntactic.py index ad99e05..8d67681 100644 --- a/src/hypothesmith/syntactic.py +++ b/src/hypothesmith/syntactic.py @@ -3,8 +3,6 @@ import ast import dis import sys -import warnings -from importlib.resources import read_text from hypothesis import assume, strategies as st from hypothesis.extra.lark import LarkStrategy @@ -13,10 +11,16 @@ # To update this grammar file, run # wget https://raw.githubusercontent.com/lark-parser/lark/master/lark/grammars/python.lark -O src/hypothesmith/python.lark -with warnings.catch_warnings(): - # `read_text()` is deprecated; I'll update once I've dropped 3.8 and earlier. - warnings.simplefilter("ignore") +if sys.version_info < (3, 9): # pragma: no cover + from importlib.resources import read_text + LARK_GRAMMAR = read_text("hypothesmith", "python.lark") +else: # pragma: no cover # not on py38, anyway + from importlib.resources import files + + LARK_GRAMMAR = ( + files("hypothesmith").joinpath("python.lark").read_text(encoding="utf8") + ) COMPILE_MODES = { "eval_input": "eval", diff --git a/tests/test_cst.py b/tests/test_cst.py index 8532240..264c9da 100644 --- a/tests/test_cst.py +++ b/tests/test_cst.py @@ -1,5 +1,7 @@ """Tests for the hypothesmith.cst module.""" + import ast +import sys from inspect import isabstract from operator import attrgetter @@ -83,6 +85,7 @@ def test_compilable_never_raises(s): compilable(s) +@pytest.mark.xfail(sys.version_info >= (3, 13), reason="parso does not support 3.13") @given(source_code=hypothesmith.from_node()) def test_parso_from_node(source_code): result = parso.parse(source_code).get_code() diff --git a/tests/test_syntactic.py b/tests/test_syntactic.py index eed06fd..eea1de5 100644 --- a/tests/test_syntactic.py +++ b/tests/test_syntactic.py @@ -1,6 +1,8 @@ """Tests for the hypothesmith.syntactic module.""" + import ast import io +import sys import tokenize import black @@ -96,6 +98,7 @@ def test_generation_without_targeting(source_code): compile(source_code, filename="", mode="exec") +@pytest.mark.xfail(sys.version_info >= (3, 13), reason="parso does not support 3.13") @given(source_code=hypothesmith.from_grammar()) def test_parso_from_grammar(source_code): result = parso.parse(source_code).get_code() diff --git a/tests/test_version.py b/tests/test_version.py index 9bd0d48..aab9801 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -1,4 +1,5 @@ """Tests for the hypothesmith package metadata.""" + import re from datetime import date from functools import lru_cache diff --git a/tox.ini b/tox.ini index f422156..666b112 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,7 @@ commands = flake8 ; mypy --config-file=tox.ini src/hypothesmith/ -[testenv:test] +[testenv:{py38-, py39-, py310-, py311-, py312-, py313-,}test] description = Runs pytest with posargs - `tox -e test -- -v` == `pytest -v` deps = --no-deps @@ -24,6 +24,7 @@ commands = # Run `tox -e deps` to update pinned dependencies [testenv:deps] +base_python = 3.10 description = Updates pinned dependencies in the `deps/*.txt` files deps = pip-tools