data-apis / array-api-compat

Compatibility layer for common array libraries to support the Array API
https://data-apis.org/array-api-compat/
MIT License
69 stars 22 forks source link

Don't wrap NumPy 2.0 at all #126

Closed asmeurer closed 5 months ago

asmeurer commented 5 months ago

This also adds a use_compat flag to array_namespace. If None, it does the default behavior. If True or False it forces the use or non-use of the compat wrapper.

Tests will fail here until https://github.com/data-apis/array-api-strict/pull/24 is released.

asmeurer commented 5 months ago

Note that I'm still running the test suite against numpy 2.0, as I want to make sure that if at any point in the future wrapping becomes necessary again that I am made aware of that.

asmeurer commented 5 months ago

This is ready to go.

Once we start supporting 2023.12, we'll probably have to add a wrapper again, if just for the new inspection APIs. My guess is that if/when that happens we'll want to have a separate wrapper namespace for NumPy 2.0 because the rest of the NumPy 1.26 wrapper functions are pointless to use with 2.0. Maybe at that point we can reuse whatever solution I come up with for https://github.com/data-apis/array-api-strict/issues/8 to streamline this.