Skip to content

Commit e242573

Browse files
authored
Merge pull request #3456 from honno/version-xp-namespaces
`extra.array_api` versioning + complex support
2 parents 3fc084f + 0e5155d commit e242573

15 files changed

+628
-111
lines changed

hypothesis-python/RELEASE.rst

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
RELEASE_TYPE: minor
2+
3+
In preparation for `future versions of the Array API standard
4+
<https://data-apis.org/array-api/latest/future_API_evolution.html>`__,
5+
:func:`~hypothesis.extra.array_api.make_strategies_namespace` now accepts an
6+
optional ``api_version`` argument, which determines the version conformed to by
7+
the returned strategies namespace. If ``None``, the version of the passed array
8+
module ``xp`` is inferred.
9+
10+
This release also introduces :func:`xps.real_dtypes`. This is currently
11+
equivalent to the existing :func:`xps.numeric_dtypes` strategy, but exists
12+
because the latter is expected to include complex numbers in the next version of
13+
the standard.

hypothesis-python/docs/conf.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,16 @@ def setup(app):
5757
app.tags.add("has_release_file")
5858

5959
# patch in mock array_api namespace so we can autodoc it
60-
from hypothesis.extra.array_api import make_strategies_namespace, mock_xp
60+
from hypothesis.extra.array_api import (
61+
RELEASED_VERSIONS,
62+
make_strategies_namespace,
63+
mock_xp,
64+
)
6165

6266
mod = types.ModuleType("xps")
63-
mod.__dict__.update(make_strategies_namespace(mock_xp).__dict__)
67+
mod.__dict__.update(
68+
make_strategies_namespace(mock_xp, api_version=RELEASED_VERSIONS[-1]).__dict__
69+
)
6470
assert "xps" not in sys.modules
6571
sys.modules["xps"] = mod
6672

hypothesis-python/docs/numpy.rst

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ The resulting namespace contains all our familiar strategies like
7575
:func:`~xps.arrays` and :func:`~xps.from_dtype`, but based on the Array API
7676
standard semantics and returning objects from the ``xp`` module:
7777

78+
..
79+
TODO: for next released xp version, include complex_dtypes here
80+
7881
.. automodule:: xps
7982
:members:
8083
from_dtype,
@@ -83,6 +86,7 @@ standard semantics and returning objects from the ``xp`` module:
8386
scalar_dtypes,
8487
boolean_dtypes,
8588
numeric_dtypes,
89+
real_dtypes,
8690
integer_dtypes,
8791
unsigned_integer_dtypes,
8892
floating_dtypes,

0 commit comments

Comments
 (0)