Resolve F401 TODO for __init__.pyi - #400
Avasam (Avasam) wants to merge 2 commits into
Conversation
|
🔒 Automated review in progress — Bill Schnurr (@bschnurr) is auto-reviewing this PR. |
| from packaging.version import parse as parse_version | ||
|
|
||
| from . import _docstring, _version, cbook, colors as colors, rcsetup | ||
| from ._typing import * |
There was a problem hiding this comment.
Warning · Non-blocking recommendation
Could you confirm that matplotlib.colors, matplotlib.cbook, and matplotlib.rcsetup are not supported package-level runtime attributes before removing these explicit re-exports? Normal usage such as import matplotlib; matplotlib.colors.Normalize(...) would otherwise lose type support; please restore any runtime-exposed modules and add a regression case.
There was a problem hiding this comment.
Kept colors just because of that one explicit example in docs. https://matplotlib.org/stable/users/explain/colors/colormapnorms.html#colormap-normalization
import matplotlib as mpl
norm = mpl.colors.Normalize(vmin=-1, vmax=1)But even matplotlib's own pyi (as of 3.8.0+, these stubs are explictly for 3.7.5) shows these were not meant for explicit re-export:
https://github.com/matplotlib/matplotlib/blob/615ff27caeeeb4934bf9164c51c92706a1cc95a0/lib/matplotlib/__init__.pyi#L1-L32
|
Result: 🔴 Verification detailsVerification: Isolated verification observed failures that were not classified as caused by this PR: Sandbox dependency and test discovery. The relevant tests could not be fully run in the isolated environment; this review is not fully verified. Summary: Verification could not begin because the disposable container failed to start with a temporary-directory `PermissionError`. Consequently, the targeted Ruff, type-checker, and stubtest checks were not run. The PR adds no tests, and confidence is limited entirely by the environment failure. Test runs: 1 failed, 2 not run
|
Bill Schnurr (bschnurr)
left a comment
There was a problem hiding this comment.
Approved via Review Center.
| from packaging.version import parse as parse_version | ||
| from matplotlib import ( | ||
| colors as colors, # Example usage: https://matplotlib.org/stable/users/explain/colors/colormapnorms.html#colormap-normalization | ||
| ) |
There was a problem hiding this comment.
Warning · Non-blocking recommendation
📍 stubs/matplotlib/init.pyi:5
The prior export-parity concern is only partially addressed: colors is restored, but normal package-level access to matplotlib.cbook and matplotlib.rcsetup remains untyped. Verify those runtime attributes and restore their explicit re-exports when supported, with regression coverage for package-qualified access.
[verified]
|
Result: Verification detailsVerification: Isolated verification observed failures whose relationship to this PR could not be determined: Mypy validation of affected stubs; this review is not fully verified. Isolated verification observed failures that were not classified as caused by this PR: Changed-file Ruff check. Summary: Ruff’s targeted F401 check passed across all stubs, and all nine changed stub files passed formatting. A broader Ruff command failed only on deleted paths and diagnostics confirmed in the base branch. Mypy could not complete because required NumPy/SciPy dependencies were unavailable; Pyright and stubtest were likewise unavailable offline. No PR-specific failure was established, so verification is partial. Test runs: 3 passed, 2 failed, 2 not run
❌
|
Removes unused imports from
__init__.pyithat are not meant as re-exports.Removes unnecessary explicit re-exports when
__all__is present in affected files.