diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 96f22ca..5c7fe2f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,4 +38,22 @@ jobs: continue-on-error: true - name: Run tests - run: pytest -v \ No newline at end of file + run: pytest -v + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + # Mypy runs on a current supported interpreter while checking code that + # remains compatible with BOOTH's minimum Python version, 3.9. + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install boothpy (editable, with dev deps) + run: pip install -e ".[dev]" + + - name: Run mypy + run: mypy src/booth/ diff --git a/pyproject.toml b/pyproject.toml index 5934a82..5ca7886 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ dependencies = [] [project.optional-dependencies] -dev = ["pytest>=7.0"] +dev = ["pytest>=7.0", "mypy>=1.19,<2.0"] [project.urls] Homepage = "https://github.com/Vedantgitbot/booth" @@ -45,4 +45,9 @@ where = ["src"] booth = ["py.typed"] [tool.pytest.ini_options] -testpaths = ["tests"] \ No newline at end of file +testpaths = ["tests"] + +[tool.mypy] +# Run mypy on Python 3.12 in CI while checking compatibility with BOOTH's +# minimum supported Python version. +python_version = "3.9"