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

BUG: Add __array_api_version__ to numpy.array_api namespace #22365

Merged
merged 1 commit into from Oct 2, 2022

Conversation

honno
Copy link
Contributor

@honno honno commented Oct 2, 2022

The Array API has always required namespaces have a __array_api_version__ attribute (see Versioning), although we all missed it heh (hopefully we can make this more visible in the spec data-apis/array-api#480). This PR introduces such an attribute.

This also fixes the issue identified in #22357 (comment) where a Hypothesis update (6.55.0) broke CI, as it required using this (specified!) attribute when using hypothesis.extra.array_api.make_strategies_namespace(), like we do in

xps = make_strategies_namespace(xp)

This PR should mean this PR works on Hypothesis versions both before and after 6.55.0.

@honno honno marked this pull request as ready for review October 2, 2022 11:42
@honno honno changed the title Add __array_api_version__ to numpy.array_api namespace BUG: Add __array_api_version__ to numpy.array_api namespace Oct 2, 2022
@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Oct 2, 2022
@charris charris merged commit 3abc097 into numpy:main Oct 2, 2022
@charris
Copy link
Member

charris commented Oct 2, 2022

Thanks @honno . Out of curiousity, does __array_api_version__ need to be in __all__?

@charris charris changed the title BUG: Add __array_api_version__ to numpy.array_api namespace BUG: Add __array_api_version__ to numpy.array_api namespace Oct 2, 2022
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Oct 2, 2022
@honno
Copy link
Contributor Author

honno commented Oct 2, 2022

Thanks @honno . Out of curiousity, does __array_api_version__ need to be in __all__?

Nope, infact there's no mention of __all__ in the spec. Just added it in __all__ out of habit heh, although I suppose it does highlight it's public API.

tylerjereddy added a commit to tylerjereddy/pykokkos that referenced this pull request Oct 4, 2022
* this is in part a copy of the NumPy patch applied at:
numpy/numpy#22365
and is related to this failure we were seeing with
`hypothesis`: kokkos#65 (comment)

* the standard section related to this is:
https://data-apis.org/array-api/latest/future_API_evolution.html#versioning

* unpin `hypothesis` in our CI as a result; to be fair,
this is the solution @ShahzadUmair wanted from the start
I think

* the updated testing behavior required me to cherry-pick
some data type info improvements from kokkosgh-97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants