Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.d/20260802_issue_44_mypy_python_39.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixed

- Keep the development mypy version below 2.0 while the template supports and
type-checks against Python 3.9.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ classifiers = [
[project.optional-dependencies]
dev = [
"ruff>=0.8.0,<0.9",
"mypy>=1.13.0",
"mypy>=1.13.0,<2.0",
"pytest>=8.3.0",
"pytest-asyncio>=0.24.0",
"pytest-cov>=6.0.0",
Expand Down
26 changes: 26 additions & 0 deletions tests/test_project_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Regression tests for project package metadata."""

from __future__ import annotations

from pathlib import Path

from packaging.requirements import Requirement

ROOT = Path(__file__).resolve().parents[1]


def dev_requirement(name: str) -> Requirement:
"""Return one requirement from the project's ``dev`` dependency group."""
pyproject = (ROOT / "pyproject.toml").read_text(encoding="utf-8")
dev_group = pyproject.split("dev = [", maxsplit=1)[1].split("]", maxsplit=1)[0]
requirement_lines = (line.strip().strip('",') for line in dev_group.splitlines())
requirements = (Requirement(line) for line in requirement_lines if line)
return next(requirement for requirement in requirements if requirement.name == name)


def test_mypy_dependency_supports_configured_python_target() -> None:
"""The dev extra must not install mypy versions that reject Python 3.9."""
mypy = dev_requirement("mypy")

assert "1.13.0" in mypy.specifier
assert "2.0" not in mypy.specifier
Loading