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

refactor: remove to_arraylib #2128

Merged
merged 6 commits into from
Jan 16, 2023
Merged

refactor: remove to_arraylib #2128

merged 6 commits into from
Jan 16, 2023

Conversation

agoose77
Copy link
Collaborator

@agoose77 agoose77 commented Jan 16, 2023

This PR

  • Removes ak._util.to_arraylib and
  • Deprecates NumpyArray.to_numpy(allow_missing) in favour of
  • Adds NumpyArray.to_backend_array(allow_missing, backend)
  • Deprecates support of UnionArray in to_backend_array().

to_arraylib() duplicates much of to_numpy()'s logic, and we also don't need to enshrine NumPy as more special than the general backend-agnos

@agoose77 agoose77 changed the title refactor: typing cleanups refactor: remove to_arraylib Jan 16, 2023
@agoose77 agoose77 marked this pull request as ready for review January 16, 2023 12:04
@codecov
Copy link

codecov bot commented Jan 16, 2023

Codecov Report

Merging #2128 (69465ea) into main (aa202ee) will increase coverage by 0.12%.
The diff coverage is 82.20%.

Additional details and impacted files
Impacted Files Coverage Δ
src/awkward/_connect/rdataframe/from_rdataframe.py 0.00% <ø> (ø)
src/awkward/_util.py 76.53% <ø> (+2.78%) ⬆️
src/awkward/operations/ak_to_cupy.py 33.33% <16.66%> (ø)
src/awkward/_nplikes.py 64.46% <50.00%> (-0.06%) ⬇️
src/awkward/contents/bitmaskedarray.py 68.02% <66.66%> (ø)
src/awkward/contents/bytemaskedarray.py 88.80% <66.66%> (ø)
src/awkward/contents/indexedarray.py 77.66% <66.66%> (ø)
src/awkward/contents/content.py 72.94% <71.42%> (-0.19%) ⬇️
src/awkward/contents/unmaskedarray.py 74.04% <75.00%> (+0.85%) ⬆️
src/awkward/contents/unionarray.py 84.98% <80.00%> (+0.59%) ⬆️
... and 15 more

@agoose77 agoose77 temporarily deployed to docs-preview January 16, 2023 12:29 — with GitHub Actions Inactive
Copy link
Member

@jpivarski jpivarski left a comment

Choose a reason for hiding this comment

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

It's great that the implementations can be unified, but there needs to be a high-level public ak.to_numpy, if only in name. There will be a lot of users who don't even know (or care) that Awkward runs on non-NumPy backends, and this will make them unlikely to find a function named ak.to_backend_array.

Nevermind: I see that you're leaving the L1 interface ak.to_numpy and just removing the L2 Content.to_numpy interface.

Currently, only NumPy has a way to use allow_missing=True; CuPy, etc. don't have a ma submodule or a MaskedArray equivalent. But in principle, they might someday get such an interface, and we can rename it through nplike if it comes in with a different name.

It's good to have the deprecation message specify version 2.2.0 like this, to always target two minor versions ahead. When this is merged, please add it directly to

https://github.com/scikit-hep/awkward/wiki#api-breaking-changes-after-20

to make sure that this list doesn't get out of date. The warning message is for developers who stumble onto this deprecation by calling Content.to_numpy, but the wiki is for a more global view: "What are all of the things that will be deprecated in version X?"

@agoose77 agoose77 merged commit 1e22929 into main Jan 16, 2023
@agoose77 agoose77 deleted the agoose77/feat-to-backend-array branch January 16, 2023 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants