Skip to content

Type errors in mypy GitHub Action #6962

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

Closed
4 tasks done
lukeconibear opened this issue Aug 28, 2022 · 5 comments · Fixed by #6963
Closed
4 tasks done

Type errors in mypy GitHub Action #6962

lukeconibear opened this issue Aug 28, 2022 · 5 comments · Fixed by #6963
Labels
CI Continuous Integration tools needs discussion

Comments

@lukeconibear
Copy link
Contributor

What happened?

Running the GitHub Action for mypy locally returned errors:

$ python -m mypy --install-types --non-interactive 
xarray/core/merge.py:43: error: "tuple" is not subscriptable  [misc]
xarray/core/merge.py:44: error: "tuple" is not subscriptable  [misc]
xarray/core/merge.py:45: error: "tuple" is not subscriptable  [misc]
xarray/backends/api.py:62: error: "dict" is not subscriptable  [misc]
Found 4 errors in 2 files (checked 144 source files)

What did you expect to happen?

No type errors from mypy.

Minimal Complete Verifiable Example

No response

MVCE confirmation

  • Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • Complete example — the example is self-contained, including all data and the text of any traceback.
  • Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • New issue — a search of GitHub Issues suggests this is not a duplicate.

Relevant log output

No response

Anything else we need to know?

No response

Environment

INSTALLED VERSIONS

commit: 3d3b236
python: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:04:10)
[GCC 10.3.0]
python-bits: 64
OS: Linux
OS-release: 5.10.60.1-microsoft-standard-WSL2
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.2
libnetcdf: 4.8.1

xarray: 2022.6.1.dev39+g3d3b236d
pandas: 1.4.3
numpy: 1.22.4
scipy: 1.9.0
netCDF4: 1.6.0
pydap: None
h5netcdf: 1.0.2
h5py: 3.7.0
Nio: None
zarr: 2.12.0
cftime: 1.6.1
nc_time_axis: 1.4.1
PseudoNetCDF: 3.2.2
rasterio: 1.3.2
cfgrib: 0.9.10.1
iris: 3.2.1
bottleneck: 1.3.5
dask: 2022.8.1
distributed: 2022.8.1
matplotlib: 3.5.3
cartopy: 0.20.3
seaborn: 0.11.2
numbagg: 0.2.1
fsspec: 2022.7.1
cupy: None
pint: 0.19.2
sparse: 0.13.0
flox: 0.5.9
numpy_groupies: 0.9.19
setuptools: 65.3.0
pip: 22.2.2
conda: None
pytest: 7.1.2
IPython: 8.4.0
sphinx: 5.1.1

@lukeconibear lukeconibear added bug needs triage Issue that has not been reviewed by xarray team member labels Aug 28, 2022
@headtr1ck
Copy link
Collaborator

Which mypy version are you using?

@lukeconibear
Copy link
Contributor Author

Which mypy version are you using?

0.971

@Illviljan
Copy link
Contributor

Illviljan commented Sep 1, 2022

Python 3.8 is used here. Is it something like this we're running into? https://stackoverflow.com/questions/62871524/is-pep-585-unusable-at-runtime-under-python-3-7-and-3-8

Maybe adding another mypy workflow for 3.8 would be a good idea?

@headtr1ck
Copy link
Collaborator

Strangely it seems to happen only as part of a Union definition.
Also we use tuple and dict all over the place and mypy does not complain anywhere else.

@headtr1ck headtr1ck added CI Continuous Integration tools needs discussion and removed needs triage Issue that has not been reviewed by xarray team member bug labels Oct 13, 2022
@headtr1ck
Copy link
Collaborator

I think we could just add a n additional mypy 3.8 workflow by using the arg --python-version 3.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration tools needs discussion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants