diff --git a/changelog.d/20260930_170131_kurtmckee_pyrefly.rst b/changelog.d/20260930_170131_kurtmckee_pyrefly.rst new file mode 100644 index 0000000..11a8adc --- /dev/null +++ b/changelog.d/20260930_170131_kurtmckee_pyrefly.rst @@ -0,0 +1,3 @@ +Development +----------- +* Use Pyrefly to test type annotations. diff --git a/pyproject.toml b/pyproject.toml index 5fb737c..197e3d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,6 +70,14 @@ strict = true sqlite_cache = true +# pyrefly +# ------- + +[tool.pyrefly] +project-includes = ["src/"] +preset = "strict" + + # pytest # ------ diff --git a/requirements/pyrefly/pyproject.toml b/requirements/pyrefly/pyproject.toml new file mode 100644 index 0000000..13dbc23 --- /dev/null +++ b/requirements/pyrefly/pyproject.toml @@ -0,0 +1,9 @@ +[tool.poetry] +package-mode = false + +[project] +name = "dependencies" +requires-python = ">=3.10" +dependencies = [ + "pyrefly", +] diff --git a/requirements/pyrefly/requirements.txt b/requirements/pyrefly/requirements.txt new file mode 100644 index 0000000..2271839 --- /dev/null +++ b/requirements/pyrefly/requirements.txt @@ -0,0 +1 @@ +pyrefly==1.3.2 ; python_version >= "3.10" diff --git a/src/chipshot/config.py b/src/chipshot/config.py index 0253a26..692c52e 100644 --- a/src/chipshot/config.py +++ b/src/chipshot/config.py @@ -39,7 +39,7 @@ def load(path: str | pathlib.Path | None = None) -> dict[str, t.Any]: if isinstance(path, str): path = pathlib.Path(path) - custom_config = {} + custom_config: dict[str, t.Any] = {} if path is not None: log.debug(f"Loading config file '{path}'") custom_config = _load_toml(path) diff --git a/tox.ini b/tox.ini index 0025bba..dee03b8 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,7 @@ envlist = coverage-report build{, -minimum} mypy-py{3.14, 3.13, 3.12, 3.11, 3.10} + pyrefly docs labels = update=update-{requirements, pre_commit, headers} @@ -70,12 +71,18 @@ commands = twine check --strict {envdir}/dist/* [testenv:mypy-py{3.14, 3.13, 3.12, 3.11, 3.10}] -description = Test type annotations on Python {py_dot_ver} +description = Test type annotations using mypy on Python {py_dot_ver} deps = -r requirements/mypy/requirements.txt setenv = MYPY_FORCE_COLOR=1 commands = mypy {posargs} +[testenv:pyrefly] +description = Test type annotations using Pyrefly +deps = -r requirements/pyrefly/requirements.txt +commands = + pyrefly check --preset strict + [testenv:docs] description = Test building the documentation base_python = py3.13 @@ -119,6 +126,8 @@ commands = poetry export --directory="requirements/docs" --output="requirements.txt" --without-hashes poetry update --directory="requirements/mypy" --lock poetry export --directory="requirements/mypy" --output="requirements.txt" --without-hashes + poetry update --directory="requirements/pyrefly" --lock + poetry export --directory="requirements/pyrefly" --output="requirements.txt" --without-hashes poetry update --directory="requirements/test" --lock poetry export --directory="requirements/test" --output="requirements.txt" --without-hashes poetry export --directory="requirements/test" --output="requirements-coverage.txt" --without-hashes --only="coverage"