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

Improved DataArray typing #6637

Merged
merged 14 commits into from
May 27, 2022
Merged

Improved DataArray typing #6637

merged 14 commits into from
May 27, 2022

Conversation

headtr1ck
Copy link
Collaborator

  • Tests added

This PR improves typing of DataArray class methods.
Main change is that T_DataArray is used whenever possible.

I have left everything untouched that would cause problems with mypy (there are some mypy bugs) or require larger typing efforts in other areas.

Main problems are argmin and argmax.

@TomNicholas
Copy link
Member

This is really great, thank you for all this work @headtr1ck !

@headtr1ck
Copy link
Collaborator Author

Should fix error nr.1 in #6576

@max-sixty
Copy link
Collaborator

This is huge, thanks @headtr1ck !

@max-sixty max-sixty enabled auto-merge (squash) May 26, 2022 19:48
auto-merge was automatically disabled May 27, 2022 06:32

Head branch was pushed to by a user without write access

@Illviljan Illviljan merged commit 3f587b4 into pydata:main May 27, 2022
@Illviljan
Copy link
Contributor

Thanks, @headtr1ck!

@max-sixty
Copy link
Collaborator

We could start setting up a lint for every function in tests being type checked (i.e. having -> None). I converted most of the files a while ago, @headtr1ck has done some of the really heavy duty ones. If we can lock that in, it would be a huge win for ensuring future tests also test our types.

There is a mypy lint for it IIRC, and I think it can be enabled on a subset of files.

@headtr1ck headtr1ck deleted the typing2 branch May 29, 2022 14:02
lstngr pushed a commit to lstngr/xarray that referenced this pull request May 31, 2022
dcherian added a commit to dcherian/xarray that referenced this pull request Jun 12, 2022
* main: (95 commits)
  Use `zarr` to validate attrs when writing to zarr (pydata#6636)
  Add pre-commit hook to check CITATION.cff (pydata#6658)
  Fix kwargs used for extrapolation in docs (pydata#6639)
  Fix notebooks' HTML links (pydata#6655)
  Doc index update (pydata#6530)
  CFTime support for polyval (pydata#6624)
  Support dask arrays in datetime_to_numeric (pydata#6556)
  [pre-commit.ci] pre-commit autoupdate (pydata#6654)
  0-padded month. (pydata#6653)
  [test-upstream] import `cleanup` fixture from `distributed` (pydata#6650)
  Allow all interp methods in typing (pydata#6647)
  Typing support for custom backends (pydata#6651)
  Improved DataArray typing (pydata#6637)
  Adjust code comments & types from pydata#6638 (pydata#6642)
  Typing of `str` and `dt` accessors (pydata#6641)
  Feature/to dict encoding (pydata#6635)
  fix {full,zeros,ones}_like overloads (pydata#6630)
  Mypy badge (pydata#6626)
  concatenate docs style (pydata#6621)
  Typing for open_dataset/array/mfdataset and to_netcdf/zarr (pydata#6612)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants