Repository navigation
change __array_function__ implementation for backwards compat - #5043
Conversation
See daskgh-5031 for discussion. Note that decorating all functions is not yet complete; this is enough to show tests in `test_numpy_compat.py` passing.
Addresses review comment on daskgh-5043. This is a lot less code, and it handles the case of, e.g., a dask array of cupy arrays correctly (this didn't work before so not needed for backwards compat, but it's nice to make it work).
Can't do in chunk.py, that would result in a circular dependency.
|
Okay, this should be complete, passes all tests in |
|
Hmm, the only failures are because warnings are inconsistently showing. On Travis: and on Appveyor: This may depend on test execution order if warnings aren't set to "always". Before I dig into CI warning settings, may be good to know if this PR is okay otherwise. Perhaps the warnings should be removed completely, not sure - that's a taste question I'd say. |
…tion__ registration
dff89bc to
5e06685
Compare
|
Only one failure left, that is consistent between all test runs: That definitely gives a warning when run standalone, so it's due to not always raising a warning or not turning warnings to errors. Can be fixed with CI settings or by removing the warning filter. I'd suggest the former, but some input would be nice on what you prefer. |
|
Right now we only have @pytest.mark.skipif(
not IS_NEP18_ACTIVE, reason="NEP-18 support is not available in NumPy"
)
def test_median_func():
...Then again, if this is testing |
|
Thanks @jrbourbeau, good catch. Updated and moved to |
|
I think I'm somewhat against having to explicitly mark all current and future dask array functions with |
|
Maybe we leave things as they are if they match the numpy API already, and we optionally have a dict for things that don't match? |
|
I think that's feasible, and a good idea. IIRC I saw a few functions that had the same name but didn't match (need to check again), but those could be added to a skip list within |
Thanks for doing this! I think that that was my main concern. It looks like the test In principle I'm fine with what's here. I suspect that others may have more technical concerns though. If there are no further comments and if tests pass then I'll plan to merge in 24 hours. |
70361d7 to
8c8bfc1
Compare
|
LGTM. Thanks a lot for the work here @rgommers! |
|
Btw, the Travis errors are just linting complaints from black. |
8c8bfc1 to
9474b8c
Compare
Grr, each time I forget to check there's a tiny tweak it wants to do. Guess you use a post-commit hook for that? |
|
You should be able to configure pre-commit hooks with |
|
This is in. Thanks @rgommers for the fix and @pentschev , @shoyer , @jrbourbeau for the review! |
|
Thanks for the help and reviews everyone! |
black dask/flake8 daskThis adds a fix and regression tests for gh-5031, and is an alternative to gh-5032. This PR is not complete yet (hence the WIP label), but enough to compare with gh-5031 and make a decision on whether this is the right approach. If so, more
@implementsdecorators need to be added.It's based on the discussion in #5031 (comment), and follows the
@implementsdecorator suggestion in NEP 18. It solves two problems:np.min is np.amin) reported in dask array failing with numpy 1.17.0rc1 and np.min #5031__array_function__that do not have adask.arrayequivalent.To explain (2) in more detail:
With dask master:
With this PR: