Skip to content

Commit

Permalink
Merge pull request #37 from jakkdl/bump_version_support
Browse files Browse the repository at this point in the history
Add basic 3.13 support, various cleanups and version bumps
  • Loading branch information
Zac-HD authored Feb 16, 2024
2 parents 33d6cac + 734efc6 commit f3273dd
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 32 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
18 changes: 6 additions & 12 deletions deps/check.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions deps/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
#
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
# hypothesis
# 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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion src/hypothesmith/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
14 changes: 9 additions & 5 deletions src/hypothesmith/syntactic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions tests/test_cst.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Tests for the hypothesmith.cst module."""

import ast
import sys
from inspect import isabstract
from operator import attrgetter

Expand Down Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions tests/test_syntactic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Tests for the hypothesmith.syntactic module."""

import ast
import io
import sys
import tokenize

import black
Expand Down Expand Up @@ -96,6 +98,7 @@ def test_generation_without_targeting(source_code):
compile(source_code, filename="<string>", 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()
Expand Down
1 change: 1 addition & 0 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the hypothesmith package metadata."""

import re
from datetime import date
from functools import lru_cache
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f3273dd

Please sign in to comment.