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

Add pyright type checker #8279

Merged
merged 3 commits into from
Oct 9, 2023
Merged

Add pyright type checker #8279

merged 3 commits into from
Oct 9, 2023

Conversation

Illviljan
Copy link
Contributor

@Illviljan Illviljan commented Oct 7, 2023

It can be helpful to get a second opinion from another typer checker than mypy.

The CI activates when the run-pyright label is added.

@github-actions github-actions bot added the Automation Github bots, testing workflows, release automation label Oct 7, 2023
@Illviljan Illviljan added the run-pyright Run pyright type checker label Oct 7, 2023
@Illviljan Illviljan marked this pull request as ready for review October 7, 2023 06:54
@Illviljan Illviljan added run-pyright Run pyright type checker and removed run-pyright Run pyright type checker labels Oct 7, 2023
@headtr1ck
Copy link
Collaborator

2144 errors, haha.
Most of them are in the tests though.

@Illviljan
Copy link
Contributor Author

pyright indeed checks different things, it's been quite useful to run both. Sometimes they hint the issue in a better way than the other.

@Illviljan Illviljan added the plan to merge Final call for comments label Oct 8, 2023
@max-sixty
Copy link
Collaborator

FWIW, I do worry a bit that getting mypy to pass can be difficult enough at times, and if we're in a situation where changing something such that mypy passes and then pyright fails, or vice-versa, could be quite painful.

But maybe that doesn't happen, and they rarely are opposing. I would be +0.7 on trying this, but with direction that it's OK to ignore things quite liberally if it slows down progress.

For those who find mypy slow, I often run with dmypy — e.g. watchexec -rc -e py -- dmypy run

@Illviljan
Copy link
Contributor Author

I was thinking it will stay an optional check, at least until pyright passes without errors. Considering there are 2000+ errors I think it'll stay optional for the foreseeable future.

We'll probably have strict mypy passing before that happens! :D

@max-sixty
Copy link
Collaborator

I was thinking it will stay an optional check, at least until pyright passes without errors. Considering there are 2000+ errors I think it'll stay optional for the foreseeable future.

Ah great, perfect!

@Illviljan Illviljan merged commit ab3dd59 into pydata:main Oct 9, 2023
28 of 30 checks passed
dcherian added a commit to dcherian/xarray that referenced this pull request Oct 14, 2023
* upstream/main: (46 commits)
  xfail flaky test (pydata#8299)
  Most of mypy 1.6.0 passing (pydata#8296)
  Rename `reset_encoding` to `drop_encoding` (pydata#8287)
  Enable `.rolling_exp` to work on dask arrays (pydata#8284)
  Fix `GroupBy` import (pydata#8286)
  Ask bug reporters to confirm they're using a recent version of xarray (pydata#8283)
  Add pyright type checker (pydata#8279)
  Improved typing of align & broadcast (pydata#8234)
  Update ci-additional.yaml (pydata#8280)
  Fix time encoding regression (pydata#8272)
  Allow a function in `.sortby` method (pydata#8273)
  make more args kw only (except 'dim') (pydata#6403)
  Use duck array ops in more places (pydata#8267)
  Don't raise rename warning if it is a no operation (pydata#8266)
  Mandate kwargs on `to_zarr` (pydata#8257)
  copy  the `dtypes` module to the `namedarray` package. (pydata#8250)
  Add xarray-regrid to ecosystem.rst (pydata#8270)
  Use strict type hinting for namedarray (pydata#8241)
  Update type annotation for center argument of dataaray_plot methods (pydata#8261)
  [pre-commit.ci] pre-commit autoupdate (pydata#8262)
  ...
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-pyright Run pyright type checker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants