Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75275b1

Browse files
committed
Add mypy stubtest CI checks
1 parent e19f283 commit 75275b1

File tree

2 files changed

+288
-0
lines changed

2 files changed

+288
-0
lines changed

.github/workflows/mypy-stubtest.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: Mypy Stubtest
3+
on: [pull_request]
4+
5+
permissions:
6+
contents: read
7+
checks: write
8+
9+
jobs:
10+
mypy-stubtest:
11+
name: mypy-stubtest
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python 3
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: 3.9
20+
21+
- name: Install mypy
22+
run: |
23+
pip3 install -r requirements/testing/mypy.txt -r requirements/testing/all.txt
24+
pip3 install .
25+
26+
- name: Run mypy stubtest
27+
run: |
28+
set -o pipefail
29+
# the ignore missing imports can be removed when typed cycler is released and used
30+
MPLBACKEND=agg python -m mypy.stubtest matplotlib --mypy-config-file pyproject.toml \
31+
--allowlist ci/mypy-stubtest-allowlist.txt

ci/mypy-stubtest-allowlist.txt

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
# Non-typed (and private) modules/functions
2+
matplotlib.backends.*
3+
matplotlib.tests.*
4+
matplotlib.pylab.*
5+
matplotlib._.*
6+
matplotlib.rcsetup._listify_validator
7+
matplotlib.rcsetup._validate_linestyle
8+
matplotlib.ft2font.*
9+
matplotlib.testing.*
10+
matplotlib.sphinxext.*
11+
12+
# set methods have heavy dynamic usage of **kwargs, with differences for subclasses
13+
# which results in technically inconsistent signatures, but not actually a problem
14+
matplotlib.*\.set$
15+
16+
# Typed inline, inconsistencies largely due to imports
17+
matplotlib.pyplot.*
18+
matplotlib.typing.*
19+
20+
# data arg "decorator"
21+
matplotlib.axes.*Axes.acorr
22+
matplotlib.axes.*Axes.angle_spectrum
23+
matplotlib.axes.*Axes.bar
24+
matplotlib.axes.*Axes.barbs
25+
matplotlib.axes.*Axes.boxplot
26+
matplotlib.axes.*Axes.broken_barh
27+
matplotlib.axes.*Axes.cohere
28+
matplotlib.axes.*Axes.contour
29+
matplotlib.axes.*Axes.contourf
30+
matplotlib.axes.*Axes.csd
31+
matplotlib.axes.*Axes.errorbar
32+
matplotlib.axes.*Axes.eventplot
33+
matplotlib.axes.*Axes.fill_between
34+
matplotlib.axes.*Axes.fill_betweenx
35+
matplotlib.axes.*Axes.hexbin
36+
matplotlib.axes.*Axes.hist
37+
matplotlib.axes.*Axes.hist2d
38+
matplotlib.axes.*Axes.hlines
39+
matplotlib.axes.*Axes.imshow
40+
matplotlib.axes.*Axes.magnitude_spectrum
41+
matplotlib.axes.*Axes.pcolor
42+
matplotlib.axes.*Axes.pcolorfast
43+
matplotlib.axes.*Axes.pcolormesh
44+
matplotlib.axes.*Axes.phase_spectrum
45+
matplotlib.axes.*Axes.pie
46+
matplotlib.axes.*Axes.plot_date
47+
matplotlib.axes.*Axes.psd
48+
matplotlib.axes.*Axes.quiver
49+
matplotlib.axes.*Axes.scatter
50+
matplotlib.axes.*Axes.specgram
51+
matplotlib.axes.*Axes.stairs
52+
matplotlib.axes.*Axes.stem
53+
matplotlib.axes.*Axes.violinplot
54+
matplotlib.axes.*Axes.vlines
55+
matplotlib.axes.*Axes.xcorr
56+
57+
# Other decorator modifying signature (maybe investigate)
58+
matplotlib.axis.Axis.draw
59+
matplotlib.offsetbox.*Offset[Bb]ox.get_offset
60+
61+
# Inconsistent super/sub class signatures (other than just name)
62+
matplotlib.ticker.MultipleLocator.set_params
63+
matplotlib.text.Annotation.get_window_extent
64+
65+
# Inconsistent super/sub class parameter name (maybe rename for consistency)
66+
matplotlib.axis.Axis.set_clip_path
67+
matplotlib.axis.Tick.set_clip_path
68+
matplotlib.image.NonUniformImage.set_filternorm
69+
matplotlib.image.NonUniformImage.set_filterrad
70+
matplotlib.projections.geo.AitoffAxes.AitoffTransform.transform_non_affine
71+
matplotlib.projections.geo.AitoffAxes.InvertedAitoffTransform.transform_non_affine
72+
matplotlib.projections.geo.HammerAxes.HammerTransform.transform_non_affine
73+
matplotlib.projections.geo.HammerAxes.InvertedHammerTransform.transform_non_affine
74+
matplotlib.projections.geo.LambertAxes.InvertedLambertTransform.transform_non_affine
75+
matplotlib.projections.geo.LambertAxes.LambertTransform.transform_non_affine
76+
matplotlib.projections.geo.MollweideAxes.InvertedMollweideTransform.transform_non_affine
77+
matplotlib.projections.geo.MollweideAxes.MollweideTransform.transform_non_affine
78+
matplotlib.projections.polar.InvertedPolarTransform.transform_non_affine
79+
matplotlib.projections.polar.PolarTransform.transform_non_affine
80+
matplotlib.projections.polar.RadialLocator.nonsingular
81+
matplotlib.scale.AsinhTransform.transform_non_affine
82+
matplotlib.scale.InvertedAsinhTransform.transform_non_affine
83+
matplotlib.scale.InvertedSymmetricalLogTransform.transform_non_affine
84+
matplotlib.scale.LogisticTransform.transform_non_affine
85+
matplotlib.scale.LogitTransform.transform_non_affine
86+
matplotlib.scale.SymmetricalLogTransform.transform_non_affine
87+
matplotlib.table.Cell.set_transform
88+
matplotlib.ticker.LogLocator.nonsingular
89+
matplotlib.ticker.LogitLocator.nonsingular
90+
matplotlib.text.Annotation.contains
91+
matplotlib.transforms.Affine2DBase.transform_affine
92+
matplotlib.transforms.AffineBase.transform_non_affine
93+
matplotlib.transforms.BlendedGenericTransform.transform_non_affine
94+
matplotlib.transforms.CompositeGenericTransform.transform_affine
95+
matplotlib.transforms.CompositeGenericTransform.transform_non_affine
96+
matplotlib.transforms.IdentityTransform.transform_affine
97+
matplotlib.transforms.IdentityTransform.transform_non_affine
98+
matplotlib.transforms.IdentityTransform.transform
99+
100+
# Stdlib/Enum considered inconsistent (no fault of ours, I don't think)
101+
matplotlib.backend_bases._Mode.__new__
102+
matplotlib.units.Number.__hash__
103+
104+
# Property read-write vs read-only weirdness, fix if possible
105+
matplotlib.offsetbox.DraggableBase.canvas
106+
matplotlib.offsetbox.DraggableBase.cids
107+
matplotlib.transforms.BboxTransform.is_separable
108+
matplotlib.transforms.BboxTransformFrom.is_separable
109+
matplotlib.transforms.BboxTransformTo.is_separable
110+
matplotlib.transforms.BlendedAffine2D.is_separable
111+
matplotlib.transforms.CompositeGenericTransform.is_separable
112+
matplotlib.transforms.TransformWrapper.input_dims
113+
matplotlib.transforms.TransformWrapper.is_separable
114+
matplotlib.transforms.TransformWrapper.output_dims
115+
116+
# 3.6 deprecations
117+
matplotlib.colorbar.Colorbar.__init__
118+
matplotlib.figure.Figure.callbacks
119+
matplotlib.figure.Figure.set_constrained_layout
120+
matplotlib.figure.Figure.set_constrained_layout_pads
121+
matplotlib.figure.Figure.set_tight_layout
122+
matplotlib.figure.SubFigure.callbacks
123+
124+
# 3.7 deprecations
125+
matplotlib.cm.register_cmap
126+
matplotlib.cm.unregister_cmap
127+
matplotlib.collections.PolyCollection.span_where
128+
matplotlib.gridspec.GridSpecBase.get_grid_positions
129+
matplotlib.widgets.Lasso.__init__
130+
matplotlib.widgets.PolygonSelector.__init__
131+
matplotlib.widgets.Slider.__init__
132+
matplotlib.widgets.RangeSlider.__init__
133+
matplotlib.widgets.TextBox.__init__
134+
matplotlib.widgets.Cursor.__init__
135+
matplotlib.widgets.MultiCursor.__init__
136+
matplotlib.widgets.SpanSelector.__init__
137+
matplotlib.widgets.ToolLineHandles.__init__
138+
matplotlib.widgets.ToolHandles.__init__
139+
matplotlib.widgets.LassoSelector.__init__
140+
matplotlib.widgets.MultiCursor.needclear
141+
142+
# 3.8 deprecations
143+
matplotlib.axes._base._AxesBase.get_tightbbox
144+
matplotlib.cbook.get_sample_data
145+
matplotlib.contour.ContourSet.allkinds
146+
matplotlib.contour.ContourSet.allsegs
147+
matplotlib.contour.ContourSet.tcolors
148+
matplotlib.contour.ContourSet.tlinewidths
149+
matplotlib.figure.FigureBase.get_tightbbox
150+
151+
# positional-only argument name lacking leading underscores
152+
matplotlib.axes._base._AxesBase.axis
153+
154+
# Aliases (dynamically generated, not type hinted)
155+
matplotlib.collections.Collection.get_dashes
156+
matplotlib.collections.Collection.get_ec
157+
matplotlib.collections.Collection.get_edgecolors
158+
matplotlib.collections.Collection.get_facecolors
159+
matplotlib.collections.Collection.get_fc
160+
matplotlib.collections.Collection.get_linestyles
161+
matplotlib.collections.Collection.get_linewidths
162+
matplotlib.collections.Collection.get_ls
163+
matplotlib.collections.Collection.get_lw
164+
matplotlib.collections.Collection.get_transOffset
165+
matplotlib.collections.Collection.set_aa
166+
matplotlib.collections.Collection.set_antialiaseds
167+
matplotlib.collections.Collection.set_dashes
168+
matplotlib.collections.Collection.set_ec
169+
matplotlib.collections.Collection.set_edgecolors
170+
matplotlib.collections.Collection.set_facecolors
171+
matplotlib.collections.Collection.set_fc
172+
matplotlib.collections.Collection.set_linestyles
173+
matplotlib.collections.Collection.set_linewidths
174+
matplotlib.collections.Collection.set_ls
175+
matplotlib.collections.Collection.set_lw
176+
matplotlib.collections.Collection.set_transOffset
177+
matplotlib.lines.Line2D.get_aa
178+
matplotlib.lines.Line2D.get_c
179+
matplotlib.lines.Line2D.get_ds
180+
matplotlib.lines.Line2D.get_ls
181+
matplotlib.lines.Line2D.get_lw
182+
matplotlib.lines.Line2D.get_mec
183+
matplotlib.lines.Line2D.get_mew
184+
matplotlib.lines.Line2D.get_mfc
185+
matplotlib.lines.Line2D.get_mfcalt
186+
matplotlib.lines.Line2D.get_ms
187+
matplotlib.lines.Line2D.set_aa
188+
matplotlib.lines.Line2D.set_c
189+
matplotlib.lines.Line2D.set_ds
190+
matplotlib.lines.Line2D.set_ls
191+
matplotlib.lines.Line2D.set_lw
192+
matplotlib.lines.Line2D.set_mec
193+
matplotlib.lines.Line2D.set_mew
194+
matplotlib.lines.Line2D.set_mfc
195+
matplotlib.lines.Line2D.set_mfcalt
196+
matplotlib.lines.Line2D.set_ms
197+
matplotlib.patches.Patch.get_aa
198+
matplotlib.patches.Patch.get_ec
199+
matplotlib.patches.Patch.get_fc
200+
matplotlib.patches.Patch.get_ls
201+
matplotlib.patches.Patch.get_lw
202+
matplotlib.patches.Patch.set_aa
203+
matplotlib.patches.Patch.set_ec
204+
matplotlib.patches.Patch.set_fc
205+
matplotlib.patches.Patch.set_ls
206+
matplotlib.patches.Patch.set_lw
207+
matplotlib.text.Text.get_c
208+
matplotlib.text.Text.get_family
209+
matplotlib.text.Text.get_font
210+
matplotlib.text.Text.get_font_properties
211+
matplotlib.text.Text.get_ha
212+
matplotlib.text.Text.get_name
213+
matplotlib.text.Text.get_size
214+
matplotlib.text.Text.get_style
215+
matplotlib.text.Text.get_va
216+
matplotlib.text.Text.get_variant
217+
matplotlib.text.Text.get_weight
218+
matplotlib.text.Text.set_c
219+
matplotlib.text.Text.set_family
220+
matplotlib.text.Text.set_font
221+
matplotlib.text.Text.set_font_properties
222+
matplotlib.text.Text.set_ha
223+
matplotlib.text.Text.set_ma
224+
matplotlib.text.Text.set_name
225+
matplotlib.text.Text.set_size
226+
matplotlib.text.Text.set_stretch
227+
matplotlib.text.Text.set_style
228+
matplotlib.text.Text.set_va
229+
matplotlib.text.Text.set_variant
230+
matplotlib.text.Text.set_weight
231+
matplotlib.axes._base._AxesBase.get_fc
232+
matplotlib.axes._base._AxesBase.set_fc
233+
234+
# Other dynamic python behaviors not type hinted
235+
matplotlib.projections.polar.PolarAxes.InvertedPolarTransform
236+
matplotlib.projections.polar.PolarAxes.PolarAffine
237+
matplotlib.projections.polar.PolarAxes.PolarTransform
238+
matplotlib.projections.polar.PolarAxes.RadialLocator
239+
matplotlib.projections.polar.PolarAxes.ThetaFormatter
240+
matplotlib.projections.polar.PolarAxes.ThetaLocator
241+
matplotlib.rcsetup.defaultParams
242+
243+
# Maybe should be abstractmethods, required for subclasses, stubs define once
244+
matplotlib.tri.*TriInterpolator.__call__
245+
matplotlib.tri.*TriInterpolator.gradient
246+
247+
# Functionally a method call, but actually a class instance, type hinted as former
248+
matplotlib.rcsetup.validate_fillstyle
249+
250+
# C-defined method without docstring indicating signature
251+
matplotlib.transforms.count_bboxes_overlapping_bbox
252+
matplotlib.transforms.update_path_extents
253+
254+
# TypeVar used only in type hints
255+
matplotlib.backend_bases.FigureCanvasBase._T
256+
matplotlib.backend_managers.ToolManager._T
257+
matplotlib.spines.Spine._T

0 commit comments

Comments
 (0)