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

Fix some typing errors in DuckArrayModule #7296

Merged
merged 4 commits into from
Nov 20, 2022

Conversation

Illviljan
Copy link
Contributor

@Illviljan Illviljan commented Nov 16, 2022

Fixes these errors that I've been seeing locally for a while:

!mypy C:\Users\J.W\Documents\GitHub\xarray\xarray\core\coordinates.py --ignore-missing-imports
C:\Users\J.W\Documents\GitHub\xarray\xarray\core\pycompat.py:48: error: Incompatible types in assignment (expression has type "Tuple[]", variable has type "Tuple[Any]")
C:\Users\J.W\Documents\GitHub\xarray\xarray\core\pycompat.py:50: error: Incompatible types in assignment (expression has type "Optional[Module]", variable has type "Optional[Literal['dask', 'pint', 'cupy', 'sparse']]")
Found 2 errors in 1 file (checked 1 source file)

Not sure why the CI isn't catching these?

Copy link
Collaborator

@headtr1ck headtr1ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, but also no idea why CI didn't catch this. For me locally this was also not catched...

xarray/core/pycompat.py Show resolved Hide resolved
xarray/core/pycompat.py Show resolved Hide resolved
@headtr1ck
Copy link
Collaborator

Not sure what is up with minimum version policy and flox but it is unrelated.

@headtr1ck headtr1ck added plan to merge Final call for comments topic-typing labels Nov 17, 2022
@Illviljan
Copy link
Contributor Author

I think the CI wasn't catching this because of:

xarray/pyproject.toml

Lines 73 to 77 in 63a69fe

# version spanning code is hard to type annotate (and most of this module will
# be going away soon anyways)
[[tool.mypy.overrides]]
ignore_errors = true
module = "xarray.core.pycompat"

@Illviljan Illviljan enabled auto-merge (squash) November 20, 2022 09:53
@Illviljan Illviljan merged commit d6671dd into pydata:main Nov 20, 2022
@headtr1ck
Copy link
Collaborator

I think the CI wasn't catching this because of:

xarray/pyproject.toml

Lines 73 to 77 in 63a69fe

# version spanning code is hard to type annotate (and most of this module will
# be going away soon anyways)
[[tool.mypy.overrides]]
ignore_errors = true
module = "xarray.core.pycompat"

Since now it seems to work, should we remove the ignore in pyproject.toml?

It seems that this module does mostly handle lazy duck module imports and not python version fixes.

@Illviljan
Copy link
Contributor Author

Yeah, sounds reasonable. Maybe the reason for the ignore disappeared once DuckArrayModule was implemented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plan to merge Final call for comments topic-typing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants