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

Remove npcompat.moveaxis #5345

Merged
merged 8 commits into from
Jun 17, 2021
Merged

Conversation

Illviljan
Copy link
Contributor

@Illviljan Illviljan commented May 19, 2021

Remove some compatibility code that doesn't seem necessary anymore.

  • Passes pre-commit run --all-files

@pep8speaks
Copy link

pep8speaks commented May 20, 2021

Hello @Illviljan! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-05-20 20:31:33 UTC

@max-sixty
Copy link
Collaborator

It's probably worth double-checking that the more complex Variable __getitem__ methods are also tested on Dask arrays. We could you an approach like #5350 if we're not confident.

@Illviljan
Copy link
Contributor Author

It's probably worth double-checking that the more complex Variable __getitem__ methods are also tested on Dask arrays. We could you an approach like #5350 if we're not confident.

I don't understand how this works, @max-sixty. You're adding the variable da to the method but where does da then later come from? It doesn't seem to be defined in this file?

The numpy implementation seems very similar to the npcompat version:
https://github.com/numpy/numpy/blob/fb215c76967739268de71aa4bda55dd1b062bc2e/numpy/core/numeric.py#L1405

Maybe the npcompat code was copy/pasted just to avoid waiting on numpy releases?

@Illviljan Illviljan changed the title Use dask.array.moveaxis Remove npcompat.moveaxis May 21, 2021
@max-sixty
Copy link
Collaborator

Yes, pytest can be a bit confusing at first, but it's a really nice framework — da comes from https://github.com/pydata/xarray/blob/v0.18.2/xarray/tests/test_dataarray.py#L6458, which is parametrized with both a numpy-backed and a dask-backed array, so it creates two tests.

I agree this seems like it should be fine, and maybe I'm being a bit too cautious. @keewis could you give this a check given my track-record is blotchy now, and we can merge if you agree?

@Illviljan Illviljan marked this pull request as ready for review May 22, 2021 11:27
Copy link
Collaborator

@keewis keewis left a comment

Choose a reason for hiding this comment

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

this does look good to me, but I'm somewhat confused about one of the comments that were removed.

Comment on lines -40 to -41
# Vendored from NumPy 1.12; we need a version that support duck typing, even
# on dask arrays with __array_function__ enabled.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure how to read this comment (added in #3084): does this mean that we still need this, even if __array_function__ is always on? @shoyer, would you be able to explain?

@max-sixty
Copy link
Collaborator

@shoyer if you get a moment, could you take a glance at this and see if it looks OK, or we should add more tests?

@dcherian
Copy link
Contributor

Thanks @Illviljan !

@dcherian dcherian merged commit 450958f into pydata:master Jun 17, 2021
@Illviljan Illviljan deleted the Illviljan-moveaxis branch July 2, 2021 16:08
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.

6 participants