Skip to content

NAS-145295 / 27.1.0 / Switch to mypy (by yocalebo) - #112

Merged
yocalebo merged 3 commits into
stable/27from
NAS-145295-27.1.0
Nov 17, 2026
Merged

yocalebo merged 3 commits into
stable/27from
NAS-145295-27.1.0

Conversation

@bugclerk

Copy link
Copy Markdown

pytype is dead (also miserably slower compared to mypy)

Original PR: #111

Pytype is no longer developed and does not support Python 3.13, and it is slow. The type check now runs mypy on Python 3.13. The job keeps the name type-check so existing required checks still match. The pytype comments in the code are removed or replaced with their mypy equivalent.

(cherry picked from commit fa98d17)
@bugclerk

Copy link
Copy Markdown
Author

Automatic cherry-pick failed. Please resolve conflicts by running:

git cherry-pick -x a66d86dea21128f195147310309238b2359e24d3
git cherry-pick -x 15d440c6f5311b0b1ebba5248f32f309e4eb313d

If the original PR was merged via a squash, you can just cherry-pick the squashed commit:

git reset --hard HEAD~1
git cherry-pick -x fcb1b7f04b0e132c66e44d0a6b86815d22890da8

@bugclerk

Copy link
Copy Markdown
Author

Mypy found errors that pytype did not report. Most were missing or loose annotations. The JSON-RPC message types are now final so mypy can narrow them by key, and an error response id may be None as JSON-RPC allows.

One fix changes behavior. When the server sends a global error that the client cannot parse, pending calls now raise a ClientException instead of quietly returning None.

(cherry picked from commit a66d86d)
By default mypy skips the bodies of functions that have no type annotations, and pytype checked them. Mypy now checks them too, which found more errors in the package and the tests. This commit fixes them without changing runtime behavior.

(cherry picked from commit 15d440c)
@yocalebo
yocalebo marked this pull request as ready for review November 17, 2026 17:20
@yocalebo
yocalebo merged commit 51fa607 into stable/27 Nov 17, 2026
3 checks passed
@yocalebo
yocalebo deleted the NAS-145295-27.1.0 branch November 17, 2026 17:22
@bugclerk

Copy link
Copy Markdown
Author

This PR has been merged and conversations have been locked.
If you would like to discuss more about this issue please use our forums or raise a Jira ticket.

@truenas truenas locked as resolved and limited conversation to collaborators Nov 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants