Skip to content
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

Allow the label run-upstream to run upstream CI #7787

Merged
merged 4 commits into from
May 1, 2023

Conversation

Illviljan
Copy link
Contributor

@Illviljan Illviljan commented Apr 26, 2023

This PR makes it easier to trigger the upstream CI and creates a mypy test for upstream as well, but only when adding this label so that it doesn't mess with the scheduled runs and those results.

Noticed the need in #7786.

@github-actions github-actions bot added the Automation Github bots, testing workflows, release automation label Apr 26, 2023
@Illviljan Illviljan added the run-upstream Run upstream CI label Apr 26, 2023
@Illviljan Illviljan marked this pull request as ready for review April 26, 2023 06:39
@dcherian
Copy link
Contributor

👍 from me!

@Illviljan
Copy link
Contributor Author

Realized I actually wanted to run mypy with the upstream packages. So added such a CI as well, but only when adding this label so that it doesn't mess with the scheduled runs and those results.

I notice quite a few mypy errors from the plot parts. If you have any ideas @headtr1ck and @ksunden you're very welcome to push more PRs!

xarray/core/options.py:12: error: Cannot assign to a type  [misc]
xarray/core/options.py:12: error: Incompatible types in assignment (expression has type "Type[str]", variable has type "Type[Colormap]")  [assignment]
xarray/plot/utils.py:808: error: Argument 1 to "set_xticks" of "_AxesBase" has incompatible type "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"; expected "Iterable[float]"  [arg-type]
xarray/plot/utils.py:810: error: Argument 1 to "set_yticks" of "_AxesBase" has incompatible type "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"; expected "Iterable[float]"  [arg-type]
xarray/plot/utils.py:813: error: Argument 1 to "set_xlim" of "_AxesBase" has incompatible type "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"; expected "Union[float, Tuple[float, float], None]"  [arg-type]
xarray/plot/utils.py:815: error: Argument 1 to "set_ylim" of "_AxesBase" has incompatible type "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"; expected "Union[float, Tuple[float, float], None]"  [arg-type]
Generated Cobertura report: /home/runner/work/xarray/xarray/mypy_report/cobertura.xml
Installing missing stub packages:
/home/runner/micromamba-root/envs/xarray-tests/bin/python -m pip install types-Pillow types-PyYAML types-Pygments types-babel types-colorama types-paramiko types-psutil types-pytz types-pywin32 types-setuptools types-urllib3


Generated Cobertura report: /home/runner/work/xarray/xarray/mypy_report/cobertura.xml
Found 154 errors in 10 files (checked 138 source files)
xarray/plot/utils.py:1349: error: Unsupported operand types for * ("_SupportsArray[dtype[Any]]" and "float")  [operator]
xarray/plot/utils.py:1349: error: Unsupported operand types for * ("_NestedSequence[_SupportsArray[dtype[Any]]]" and "float")  [operator]
xarray/plot/utils.py:1349: error: Unsupported operand types for * ("_NestedSequence[Union[bool, int, float, complex, str, bytes]]" and "float")  [operator]
xarray/plot/utils.py:1349: note: Left operand is of type "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"
xarray/plot/utils.py:1349: error: Unsupported operand types for * ("str" and "float")  [operator]
xarray/plot/utils.py:1349: error: Unsupported operand types for * ("bytes" and "float")  [operator]
xarray/plot/utils.py:1350: error: Item "_SupportsArray[dtype[Any]]" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1350: error: Item "_NestedSequence[_SupportsArray[dtype[Any]]]" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1350: error: Item "int" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1350: error: Item "float" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1350: error: Item "complex" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1350: error: Item "str" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1350: error: Item "bytes" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1350: error: Item "_NestedSequence[Union[bool, int, float, complex, str, bytes]]" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1351: error: Item "_SupportsArray[dtype[Any]]" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1351: error: Item "_NestedSequence[_SupportsArray[dtype[Any]]]" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1351: error: Item "int" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1351: error: Item "float" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1351: error: Item "complex" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1351: error: Item "str" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1351: error: Item "bytes" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/utils.py:1351: error: Item "_NestedSequence[Union[bool, int, float, complex, str, bytes]]" of "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" has no attribute "mask"  [union-attr]
xarray/plot/facetgrid.py:684: error: "FigureCanvasBase" has no attribute "get_renderer"  [attr-defined]
xarray/plot/accessor.py:182: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:182: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:309: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:309: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:428: error: Overloaded function implementation cannot produce return type of signature 2  [misc]
xarray/plot/accessor.py:428: error: Overloaded function implementation cannot produce return type of signature 3  [misc]
xarray/plot/accessor.py:433: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:433: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:552: error: Overloaded function implementation cannot produce return type of signature 2  [misc]
xarray/plot/accessor.py:552: error: Overloaded function implementation cannot produce return type of signature 3  [misc]
xarray/plot/accessor.py:557: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:557: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:676: error: Overloaded function implementation cannot produce return type of signature 2  [misc]
xarray/plot/accessor.py:676: error: Overloaded function implementation cannot produce return type of signature 3  [misc]
xarray/plot/accessor.py:681: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:681: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:800: error: Overloaded function implementation cannot produce return type of signature 2  [misc]
xarray/plot/accessor.py:800: error: Overloaded function implementation cannot produce return type of signature 3  [misc]
xarray/plot/accessor.py:948: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:948: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:1075: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:1075: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:1190: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/accessor.py:1190: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/dataset_plot.py:324: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/dataset_plot.py:324: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/dataset_plot.py:478: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/dataset_plot.py:478: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "x"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "y"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "u"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "v"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "density"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "linewidth"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "color"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "cmap"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "norm"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "arrowsize"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "arrowstyle"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "minlength"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "transform"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "zorder"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "start_points"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "maxlength"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "integration_direction"  [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument "broken_streamlines"  [misc]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type "*List[ndarray[Any, Any]]"; expected "Union[float, Tuple[float, float]]"  [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type "*List[ndarray[Any, Any]]"; expected "Union[str, Colormap, None]"  [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type "*List[ndarray[Any, Any]]"; expected "Union[str, Normalize, None]"  [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type "*List[ndarray[Any, Any]]"; expected "float"  [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type "*List[ndarray[Any, Any]]"; expected "Union[str, ArrowStyle]"  [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type "*List[ndarray[Any, Any]]"; expected "Optional[Transform]"  [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type "*List[ndarray[Any, Any]]"; expected "Optional[float]"  [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type "*List[ndarray[Any, Any]]"; expected "Literal['forward', 'backward', 'both']"  [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type "*List[ndarray[Any, Any]]"; expected "bool"  [arg-type]
xarray/plot/dataset_plot.py:751: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/dataset_plot.py:751: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/dataarray_plot.py:718: error: Incompatible return value type (got "Tuple[Union[ndarray[Any, Any], List[ndarray[Any, Any]]], ndarray[Any, Any], Union[BarContainer, Polygon, List[Union[BarContainer, Polygon]]]]", expected "Tuple[ndarray[Any, Any], ndarray[Any, Any], BarContainer]")  [return-value]
xarray/plot/dataarray_plot.py:996: error: "Axes" has no attribute "view_init"  [attr-defined]
xarray/plot/dataarray_plot.py:1106: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/dataarray_plot.py:1106: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/dataarray_plot.py:1261: error: Argument 1 to "scatter" of "Axes" has incompatible type "*List[ndarray[Any, Any]]"; expected "Union[Sequence[Union[Union[Tuple[float, float, float], str], Union[str, Tuple[float, float, float, float], Tuple[Union[Tuple[float, float, float], str], float], Tuple[Tuple[float, float, float, float], float]]]], Union[Union[Tuple[float, float, float], str], Union[str, Tuple[float, float, float, float], Tuple[Union[Tuple[float, float, float], str], float], Tuple[Tuple[float, float, float, float], float]]], None]"  [arg-type]
xarray/plot/dataarray_plot.py:1261: error: Argument 1 to "scatter" of "Axes" has incompatible type "*List[ndarray[Any, Any]]"; expected "Optional[Union[str, Path, MarkerStyle]]"  [arg-type]
xarray/plot/dataarray_plot.py:1261: error: Argument 1 to "scatter" of "Axes" has incompatible type "*List[ndarray[Any, Any]]"; expected "Union[str, Colormap, None]"  [arg-type]
xarray/plot/dataarray_plot.py:1261: error: Argument 1 to "scatter" of "Axes" has incompatible type "*List[ndarray[Any, Any]]"; expected "Union[str, Normalize, None]"  [arg-type]
xarray/plot/dataarray_plot.py:1261: error: Argument 1 to "scatter" of "Axes" has incompatible type "*List[ndarray[Any, Any]]"; expected "Optional[float]"  [arg-type]
xarray/plot/dataarray_plot.py:1261: error: Argument 1 to "scatter" of "Axes" has incompatible type "*List[ndarray[Any, Any]]"; expected "Union[float, Sequence[float], None]"  [arg-type]
xarray/plot/dataarray_plot.py:1615: error: "Axes" has no attribute "set_zlabel"  [attr-defined]
xarray/plot/dataarray_plot.py:1655: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/dataarray_plot.py:1655: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/dataarray_plot.py:1874: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/dataarray_plot.py:1874: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/dataarray_plot.py:2010: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/dataarray_plot.py:2010: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/dataarray_plot.py:2146: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
xarray/plot/dataarray_plot.py:2146: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
xarray/plot/dataarray_plot.py:2464: error: "Axes" has no attribute "plot_surface"  [attr-defined]
xarray/tests/test_plot.py:427: error: Value of type "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" is not indexable  [index]
xarray/tests/test_plot.py:443: error: Module has no attribute "viridis"  [attr-defined]
xarray/tests/test_plot.py:457: error: "None" not callable  [misc]
xarray/tests/test_plot.py:462: error: "None" not callable  [misc]
xarray/tests/test_plot.py:465: error: "None" not callable  [misc]
xarray/tests/test_plot.py:471: error: Module has no attribute "viridis"  [attr-defined]
xarray/tests/test_plot.py:477: error: Module has no attribute "viridis"  [attr-defined]
xarray/tests/test_plot.py:482: error: Module has no attribute "viridis"  [attr-defined]
xarray/tests/test_plot.py:486: error: Module has no attribute "viridis"  [attr-defined]
xarray/tests/test_plot.py:493: error: "None" not callable  [misc]
xarray/tests/test_plot.py:498: error: "None" not callable  [misc]
xarray/tests/test_plot.py:501: error: "None" not callable  [misc]
xarray/tests/test_plot.py:931: error: Module has no attribute "magma"  [attr-defined]
xarray/tests/test_plot.py:933: error: Module has no attribute "magma"  [attr-defined]
xarray/tests/test_plot.py:1173: error: Module has no attribute "RdBu"  [attr-defined]
xarray/tests/test_plot.py:1746: error: Item "Colormap" of "Optional[Colormap]" has no attribute "colors"  [union-attr]
xarray/tests/test_plot.py:1746: error: Item "None" of "Optional[Colormap]" has no attribute "colors"  [union-attr]
xarray/tests/test_plot.py:1747: error: Item "Colormap" of "Optional[Colormap]" has no attribute "colors"  [union-attr]
xarray/tests/test_plot.py:1747: error: Item "None" of "Optional[Colormap]" has no attribute "colors"  [union-attr]
xarray/tests/test_plot.py:1749: error: Item "Colormap" of "Optional[Colormap]" has no attribute "_rgba_over"  [union-attr]
xarray/tests/test_plot.py:1749: error: Item "None" of "Optional[Colormap]" has no attribute "_rgba_over"  [union-attr]
xarray/tests/test_plot.py:1801: error: Item "None" of "Optional[ndarray[Any, Any]]" has no attribute "size"  [union-attr]
xarray/tests/test_plot.py:1952: error: Item "None" of "Optional[ndarray[Any, Any]]" has no attribute "min"  [union-attr]
xarray/tests/test_plot.py:1952: error: Item "None" of "Optional[ndarray[Any, Any]]" has no attribute "max"  [union-attr]
xarray/tests/test_plot.py:1968: error: Item "None" of "Optional[ndarray[Any, Any]]" has no attribute "dtype"  [union-attr]
xarray/tests/test_plot.py:1969: error: Value of type "Optional[ndarray[Any, Any]]" is not indexable  [index]
xarray/tests/test_plot.py:2125: error: "Artist" has no attribute "get_clim"  [attr-defined]
xarray/tests/test_plot.py:2135: error: "Colorbar" has no attribute "vmin"  [attr-defined]
xarray/tests/test_plot.py:2136: error: "Colorbar" has no attribute "vmax"  [attr-defined]
xarray/tests/test_plot.py:2202: error: "Artist" has no attribute "get_clim"  [attr-defined]
xarray/tests/test_plot.py:2218: error: "Artist" has no attribute "norm"  [attr-defined]
xarray/tests/test_plot.py:2747: error: Item "_AxesBase" of "Optional[_AxesBase]" has no attribute "legend_"  [union-attr]
xarray/tests/test_plot.py:2747: error: Item "None" of "Optional[_AxesBase]" has no attribute "legend_"  [union-attr]
xarray/tests/test_plot.py:2754: error: Item "None" of "Optional[_AxesBase]" has no attribute "get_legend"  [union-attr]
xarray/tests/test_plot.py:2775: error: Item "None" of "Optional[FigureBase]" has no attribute "axes"  [union-attr]
xarray/tests/test_plot.py:2775: error: Argument 1 to "len" has incompatible type "Union[_AxesBase, None, Any]"; expected "Sized"  [arg-type]
xarray/tests/test_plot.py:2803: error: Module has no attribute "dates"  [attr-defined]
xarray/tests/test_plot.py:2812: error: Module has no attribute "dates"  [attr-defined]
xarray/tests/test_plot.py:2831: error: Item "None" of "Optional[_AxesBase]" has no attribute "xaxis"  [union-attr]
xarray/tests/test_plot.py:2831: error: Module has no attribute "dates"  [attr-defined]
xarray/tests/test_groupby.py:715: error: Argument 1 to "groupby" of "Dataset" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "Union[Hashable, DataArray, IndexVariable]"  [arg-type]
xarray/tests/test_groupby.py:715: note: Following member(s) of "ndarray[Any, dtype[signedinteger[Any]]]" have conflicts:
xarray/tests/test_groupby.py:715: note:     __hash__: expected "Callable[[], int]", got "None"
xarray/tests/test_dataset.py:6964: error: "PlainQuantity[Any]" not callable  [operator]
xarray/tests/test_dataset.py:6965: error: "PlainQuantity[Any]" not callable  [operator]
xarray/tests/test_dataset.py:7007: error: "PlainQuantity[Any]" not callable  [operator]
xarray/tests/test_dataset.py:7008: error: "PlainQuantity[Any]" not callable  [operator]
xarray/tests/test_dataarray.py:6687: error: "PlainQuantity[Any]" not callable  [operator]
xarray/tests/test_dataarray.py:6689: error: "PlainQuantity[Any]" not callable  [operator]
xarray/tests/test_dataarray.py:6735: error: "PlainQuantity[Any]" not callable  [operator]
xarray/tests/test_dataarray.py:6737: error: "PlainQuantity[Any]" not callable  [operator]

@ksunden
Copy link
Contributor

ksunden commented Apr 26, 2023

Tackling a few of them (but not all in one go):

  • [xy]ticks in mpl is currently overly narrowly type hinted because I was following the docstring, but I agree that ArrayLike is a better type hint for that, plan on updating (including the docstring) upstream
  • [xy]lim originally neglected the case of passing set_xlim((min, max)) as a tuple, but that has been updated. xarray has that type hinted as array like, but mpl has it hinted as a 2-tuple (I think it is currently still of floats, but may be expanded as we more directly address units/categoricals/etc). Willing to debate here, but my starting position is that the "exactly 2 values" is valuable info here, and I think tuple is the only way to do that.
  • get_renderer is not actually available on all of our backends, we should maybe see if there is a more preferred way of doing what you are doing here that will work for all backends, but haven't looked into it too closely.
  • Module has no attribute <colormap> is another instance of dynamically generated behavior which can't be statically type checked (elegantly, at least), can probably be replaced by mpl.colormaps["<colormap>"] in many cases, which is statically typecheckable
  • Anything to do with 3D Axes is not type hinted, perhaps ignore for now (or help us get that type hinted adequately, but it is relatively low priority currently)
  • Module has no attribute "dates" we don't currently type hint dates/units things, but it is on my mind, not sure yet if it will be in first release or not though (may at least put a placeholder that gets rid of this error, but treats everything as "Any").

@ksunden
Copy link
Contributor

ksunden commented Apr 28, 2023

The suggestion from mpl (specifically @tacaswell) was to use constrained layout for the purpose that xarray currently uses get_renderer, this will ensure that the facetgrid works with all mpl backends.

@tacaswell
Copy link

I'm also relatively sure that if you are willing to put a floor on the version of Matplotlib you support get_window_extent will use it's internally cached renderer (and when we make it uniformly optional we also fixed the cache invalidation logic).

@Illviljan Illviljan added the plan to merge Final call for comments label Apr 30, 2023
@Illviljan Illviljan merged commit 6310957 into pydata:main May 1, 2023
@Illviljan
Copy link
Contributor Author

Thanks, @ksunden and @tacaswell for the guidance we'll tackle these in separate PRs, see #7802.

dcherian added a commit to dcherian/xarray that referenced this pull request May 6, 2023
* main:
  Introduce Grouper objects internally (pydata#7561)
  [skip-ci] Add cftime groupby, resample benchmarks (pydata#7795)
  Fix groupby binary ops when grouped array is subset relative to other (pydata#7798)
  adjust the deprecation policy for python (pydata#7793)
  [pre-commit.ci] pre-commit autoupdate (pydata#7803)
  Allow the label run-upstream to run upstream CI (pydata#7787)
  Update asv links in contributing guide (pydata#7801)
  Implement DataArray.to_dask_dataframe() (pydata#7635)
  `ds.to_dict` with data as arrays, not lists (pydata#7739)
  Add lshift and rshift operators (pydata#7741)
  Use canonical name for set_horizonalalignment over alias set_ha (pydata#7786)
  Remove pandas<2 pin (pydata#7785)
  [pre-commit.ci] pre-commit autoupdate (pydata#7783)
@Illviljan Illviljan deleted the ci_upstream_label branch March 13, 2024 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Automation Github bots, testing workflows, release automation plan to merge Final call for comments run-upstream Run upstream CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants