From 8f3907630b5dc94b171c133ffba495f626fe6a0c Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Wed, 14 Oct 2026 21:13:33 +0200 Subject: [PATCH] Fix dpnp.__all__ missing ndarray and __array_namespace_info__ The data types block reassigned __all__ instead of extending it, which dropped the two names listed before it. Also remove mean, median and min from the mathematical functions block; they are listed with statistics, where they are imported. --- CHANGELOG.md | 1 + dpnp/__init__.py | 5 +---- dpnp/tests/test_public_api.py | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 dpnp/tests/test_public_api.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d6b8161ef84..aaaf3c68fafa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -118,6 +118,7 @@ This release is compatible with NumPy 2.5. * Fixed incorrect results of `dpnp.tensor.vecdot` in some cases with strided outputs and of `dpnp.tensor` reductions, `dpnp.tensor.vecdot` and `dpnp.tensor.matmul` on large inputs with some data types [#3082](https://github.com/IntelPython/dpnp/pull/3082) * Fixed `dpnp.median` and `dpnp.nanmedian` raising a `ValueError` for a tuple `axis` when a kept dimension has size 0 [#3081](https://github.com/IntelPython/dpnp/pull/3081) * Fixed a `RuntimeError` raised by `dpnp.tensor` kernels launched over more than `INT_MAX` work-items when built with DPC++ compiler 2026.2 or newer, by also passing `-fno-sycl-id-queries-fit-in-int` to the linker [#3089](https://github.com/IntelPython/dpnp/pull/3089) +* Fixed `dpnp.__all__` missing `ndarray` and `__array_namespace_info__` and listing `mean`, `median` and `min` twice [#3100](https://github.com/IntelPython/dpnp/pull/3100) ### Security diff --git a/dpnp/__init__.py b/dpnp/__init__.py index 8cb2858c8de2..68a683d8095d 100644 --- a/dpnp/__init__.py +++ b/dpnp/__init__.py @@ -591,7 +591,7 @@ __all__ = ["__array_namespace_info__", "ndarray"] # Data types -__all__ = [ +__all__ += [ "bool", "bool_", "byte", @@ -920,9 +920,6 @@ "logaddexp2", "logsumexp", "maximum", - "mean", - "median", - "min", "minimum", "mod", "modf", diff --git a/dpnp/tests/test_public_api.py b/dpnp/tests/test_public_api.py new file mode 100644 index 000000000000..83381ba83d39 --- /dev/null +++ b/dpnp/tests/test_public_api.py @@ -0,0 +1,16 @@ +import pytest + +import dpnp + + +class TestAll: + def test_no_duplicates(self): + assert len(dpnp.__all__) == len(set(dpnp.__all__)) + + def test_names_resolve(self): + missing = [name for name in dpnp.__all__ if not hasattr(dpnp, name)] + assert not missing + + @pytest.mark.parametrize("name", ["__array_namespace_info__", "ndarray"]) + def test_contains(self, name): + assert name in dpnp.__all__