Skip to content

CI: Resolve mypy stubtest build errors #28978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

scottshambaugh
Copy link
Contributor

@scottshambaugh scottshambaugh commented Oct 15, 2024

PR summary

I believe there must have been a dependency update in the last day or two that made mypy checks more strict, as Mypy Stubtest CI began failing with the below errors:

error: not checking stubs due to mypy build errors:
.tox/stubtest/lib/python3.12/site-packages/matplotlib/tests/test_basic.py:14: error: "type: ignore" comment without error code  [ignore-without-code]
.tox/stubtest/lib/python3.12/site-packages/matplotlib/tests/test_cbook.py:189: error: "type: ignore" comment without error code (consider "type: ignore[assignment]" instead)  [ignore-without-code]
.tox/stubtest/lib/python3.12/site-packages/matplotlib/tests/test_pickle.py:20: error: "type: ignore" comment without error code  [ignore-without-code]
.tox/stubtest/lib/python3.12/site-packages/matplotlib/tests/test_legend.py:405: error: "type: ignore" comment without error code  [ignore-without-code]
.tox/stubtest/lib/python3.12/site-packages/matplotlib/tests/test_colors.py:1418: error: "type: ignore" comment without error code (consider "type: ignore[explicit-override, misc]" instead)  [ignore-without-code]
.tox/stubtest/lib/python3.12/site-packages/matplotlib/tests/test_collections.py:459: error: "type: ignore" comment without error code  [ignore-without-code]
.tox/stubtest/lib/python3.12/site-packages/matplotlib/tests/test_backend_gtk3.py:10: error: "type: ignore" comment without error code  [ignore-without-code]
.tox/stubtest/lib/python3.12/site-packages/matplotlib/tests/test_axes.py:36: error: "type: ignore" comment without error code  [ignore-without-code]
.tox/stubtest/lib/python3.12/site-packages/matplotlib/tests/test_axes.py:2979: error: If condition is always true  [redundant-expr]
.tox/stubtest/lib/python3.12/site-packages/matplotlib/tests/test_backend_qt.py:18: error: "type: ignore" comment without error code (consider "type: ignore[attr-defined]" instead)  [ignore-without-code]
.tox/stubtest/lib/python3.12/site-packages/matplotlib/tests/test_backends_interactive.py:89: error: "type: ignore" comment without error code  [ignore-without-code]

This resolves those with more specific ignore comments. Note that running mypy was not broken, this specifically came up when running tox -e stubtest. I did not check each one to see if the #ignore comments were still necessary.

PR checklist

@scottshambaugh scottshambaugh added the CI: testing CI configuration and testing label Oct 15, 2024
@scottshambaugh scottshambaugh changed the title CI: Resolve mypy build errors CI: Resolve mypy stubtest build errors Oct 15, 2024
Linting

Linting

Simplify check

Import even though unused to smoke test
@@ -15,7 +15,8 @@
from matplotlib import _c_internal_utils

try:
from matplotlib.backends.qt_compat import QtGui, QtWidgets # type: ignore # noqa
from matplotlib.backends.qt_compat import QtGui # type: ignore[attr-defined] # noqa: E501, F401
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kept this import even though unused in order to smoke test the module

@@ -2976,7 +2976,7 @@ def test_scatter_singular_plural_arguments(self):


def _params(c=None, xsize=2, *, edgecolors=None, **kwargs):
return (c, edgecolors, kwargs if kwargs is not None else {}, xsize)
return (c, edgecolors, kwargs, xsize)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

kwargs defaults to a dict if not provided, so the check here was redundant and raising an error

@QuLogic QuLogic merged commit 47554f3 into matplotlib:main Oct 15, 2024
41 of 43 checks passed
@QuLogic QuLogic added this to the v3.10.0 milestone Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: testing CI configuration and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants