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

Move main array namespace #307

Open
tomwhite opened this issue Sep 13, 2023 · 4 comments
Open

Move main array namespace #307

tomwhite opened this issue Sep 13, 2023 · 4 comments

Comments

@tomwhite
Copy link
Member

tomwhite commented Sep 13, 2023

Currently all the array functions are in cubed.array_api. This was created to follow the naming pattern for the new array API in numpy.array_api. Since then, however, there has been a change in emphasis to view numpy.array_api as a reference implementation so downstream libraries can test if they are using only array API functions - it is no longer recommended for end users to use it directly, since array libraries are slowly migrating their main namespaces to implement the array API. This includes NumPy in version 2.0, and in the meantime there is array-api-compat to ease migration for users of NumPy, CuPy, and PyTorch.

The upshot for Cubed is that we should probably move away from cubed.array_api for the above reasons, but also so we can add new functions that are not yet standardised, such as nansum (see #153).

The two options I see are:

  1. cubed
  2. cubed.array

Thoughts?

@TomNicholas
Copy link
Member

TomNicholas commented Sep 18, 2023

The two options I see are:

  1. cubed
  2. cubed.array

Thoughts?

Either seems fine. (2) might be slightly better, because it would follow dask.array, and separate out the namespace for cubed things that aren't actually array operations (e.g. Spec).

EDIT: On the other hand dask.array only really exists because you can have dask collections that are not arrays, which wouldn't make sense for cubed...

@tomwhite
Copy link
Member Author

I went through the same thought process: cubed.array following dask.array, but then thinking that actually cubed is appropriate as Cubed is just an array library.

@tomwhite
Copy link
Member Author

Another very good explanation of the decision to move away from the separate array_api namespace pattern: numpy/numpy#23883 (comment)

@TomNicholas
Copy link
Member

That's really interesting.

Related: I would like to test cubed(/pint/sparse/every other array library) by using hypothesis.extra.array_api.make_strategies_namespace, which requires passing in the array-API-compliant namespace directly. See these docs (just released in the latest version of xarray) for an explanation of what I'm talking about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants