cubed
cubed copied to clipboard
Move main array namespace
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:
cubedcubed.array
Thoughts?
The two options I see are:
cubedcubed.arrayThoughts?
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...
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.
Another very good explanation of the decision to move away from the separate array_api namespace pattern: https://github.com/numpy/numpy/issues/23883#issuecomment-1851429299
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.