Skip to content

chore(deps): upgrade mypy and pytest with Python 3.9 version markers#325

Merged
jericht merged 2 commits into
mainlinefrom
jericht/pin_39_deps
Jul 3, 2026
Merged

chore(deps): upgrade mypy and pytest with Python 3.9 version markers#325
jericht merged 2 commits into
mainlinefrom
jericht/pin_39_deps

Conversation

@jericht

@jericht jericht commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Upgrade mypy (to 2.1.), pytest (to 9.1.), and black (to 26.*) per dependabot PRs #322, #320, and #323, while maintaining Python 3.9 compatibility using environment markers.

Changes

requirements-testing.txt:

  • mypy == 1.19.*; python_version == "3.9" / mypy == 2.1.*; python_version >= "3.10"
  • pytest == 8.4.*; python_version == "3.9" / pytest == 9.1.*; python_version >= "3.10"
  • black == 25.*; python_version == "3.9" / black == 26.*; python_version >= "3.10"

pyproject.toml:

  • Remove python_version = 3.9 from [tool.mypy] — mypy now infers the target from the running Python. Required because mypy 2.x dropped support for targeting 3.9.

test/openjd/sessions_v0/test_session.py:

  • Add assert session._logger.extra is not None to satisfy mypy 2.x stricter nullable type checking.

Context

mypy 2.x, pytest 9.x, and black 26.x all dropped Python 3.9 support. Rather than blocking the upgrades entirely, this uses pip environment markers to install the last compatible version on Python 3.9 and the latest on 3.10+.

Supersedes #320, #322, and #323.

@jericht
jericht requested a review from a team as a code owner July 2, 2026 23:49
Comment thread pyproject.toml
show_error_context = true
strict_equality = false
python_version = 3.9
warn_redundant_casts = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing python_version = 3.9 means mypy now targets whatever interpreter it runs under (Python 3.10+ per the new mypy == 2.1.* split) instead of the minimum supported version. As a result type-checking will no longer catch code that uses 3.10+-only syntax/APIs but must still run on 3.9 (which is still in requires-python = ">=3.9" and the classifiers). Consider keeping the target pinned to the floor, e.g. python_version = "3.9" (quoted, since mypy 2.x is stricter about the value type), so 3.9 incompatibilities are still flagged.

jericht added 2 commits July 2, 2026 23:55
Upgrade deps per dependabot PRs:
- mypy: 1.19.* for Python 3.9, 2.1.* for Python >=3.10
- pytest: 8.4.* for Python 3.9, 9.1.* for Python >=3.10

mypy 2.x and pytest 9.x both dropped Python 3.9 support. Use
environment markers so Python 3.9 CI stays on the last compatible
versions while 3.10+ gets the latest.

Also remove python_version = 3.9 from [tool.mypy] so mypy infers the
target from the running Python — required because mypy 2.x dropped
support for targeting 3.9.

Signed-off-by: Jericho Tolentino <68654047+jericht@users.noreply.github.com>
mypy 2.x is stricter about Mapping | None — add an explicit assertion
before accessing session._logger.extra.

Signed-off-by: Jericho Tolentino <68654047+jericht@users.noreply.github.com>
@jericht
jericht force-pushed the jericht/pin_39_deps branch from c803bd3 to fae5496 Compare July 2, 2026 23:55
@jericht
jericht merged commit 50cc323 into mainline Jul 3, 2026
38 of 42 checks passed
@jericht
jericht deleted the jericht/pin_39_deps branch July 3, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants