Skip to content

Commit 8567fda

Browse files
Unified public API definitions in dpnp.linalg and dpnp.scipy (#2663)
This PR proposes to unify public API definitions in `dpnp.linalg` and `dpnp.scipy` by removing redundant `__all__` declarations from interna files and defining exports only in the corresponding `__init__.py`
1 parent 789d3eb commit 8567fda

File tree

7 files changed

+35
-72
lines changed

7 files changed

+35
-72
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Also, that release drops support for Python 3.9, making Python 3.10 the minimum
3535
* Redesigned `dpnp.modf` function to be a part of `ufunc` and `vm` pybind11 extensions [#2654](https://github.com/IntelPython/dpnp/pull/2654)
3636
* Refactored `dpnp.fft` and `dpnp.random` submodules by removing wildcard imports and defining explicit public exports [#2649](https://github.com/IntelPython/dpnp/pull/2649)
3737
* Added support for the `out` keyword to accept a tuple, bringing ufunc signatures into alignment with those in NumPy [#2664](https://github.com/IntelPython/dpnp/pull/2664)
38+
* Unified public API definitions in `dpnp.linalg` and `dpnp.scipy` submodules [#2663](https://github.com/IntelPython/dpnp/pull/2663)
3839

3940
### Deprecated
4041

dpnp/linalg/__init__.py

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838

3939
from .dpnp_iface_linalg import (
4040
LinAlgError,
41-
)
42-
from .dpnp_iface_linalg import __all__ as __all__linalg
43-
from .dpnp_iface_linalg import (
4441
cholesky,
4542
cond,
4643
cross,
@@ -74,4 +71,37 @@
7471
vector_norm,
7572
)
7673

77-
__all__ = __all__linalg
74+
__all__ = [
75+
"LinAlgError",
76+
"cholesky",
77+
"cond",
78+
"cross",
79+
"det",
80+
"diagonal",
81+
"eig",
82+
"eigh",
83+
"eigvals",
84+
"eigvalsh",
85+
"inv",
86+
"lstsq",
87+
"matmul",
88+
"matrix_norm",
89+
"matrix_power",
90+
"matrix_rank",
91+
"matrix_transpose",
92+
"multi_dot",
93+
"norm",
94+
"outer",
95+
"pinv",
96+
"qr",
97+
"solve",
98+
"svd",
99+
"svdvals",
100+
"slogdet",
101+
"tensordot",
102+
"tensorinv",
103+
"tensorsolve",
104+
"trace",
105+
"vecdot",
106+
"vector_norm",
107+
]

dpnp/linalg/dpnp_iface_linalg.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -72,41 +72,6 @@
7272
dpnp_svd,
7373
)
7474

75-
__all__ = [
76-
"LinAlgError",
77-
"cholesky",
78-
"cond",
79-
"cross",
80-
"det",
81-
"diagonal",
82-
"eig",
83-
"eigh",
84-
"eigvals",
85-
"eigvalsh",
86-
"inv",
87-
"lstsq",
88-
"matmul",
89-
"matrix_norm",
90-
"matrix_power",
91-
"matrix_rank",
92-
"matrix_transpose",
93-
"multi_dot",
94-
"norm",
95-
"outer",
96-
"pinv",
97-
"qr",
98-
"solve",
99-
"svd",
100-
"svdvals",
101-
"slogdet",
102-
"tensordot",
103-
"tensorinv",
104-
"tensorsolve",
105-
"trace",
106-
"vecdot",
107-
"vector_norm",
108-
]
109-
11075
# Need to set the module explicitly, because it's initially exposed by LAPACK
11176
# pybind11 extension and to add the docstrings
11277
LinAlgError.__module__ = "dpnp.linalg"

dpnp/linalg/dpnp_utils_linalg.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,6 @@
5454
import dpnp.backend.extensions.lapack._lapack_impl as li
5555
from dpnp.dpnp_utils import get_usm_allocations
5656

57-
__all__ = [
58-
"assert_2d",
59-
"assert_stacked_2d",
60-
"assert_stacked_square",
61-
"dpnp_cholesky",
62-
"dpnp_cond",
63-
"dpnp_det",
64-
"dpnp_eigh",
65-
"dpnp_inv",
66-
"dpnp_lstsq",
67-
"dpnp_matrix_power",
68-
"dpnp_matrix_rank",
69-
"dpnp_multi_dot",
70-
"dpnp_norm",
71-
"dpnp_pinv",
72-
"dpnp_qr",
73-
"dpnp_slogdet",
74-
"dpnp_solve",
75-
"dpnp_svd",
76-
]
77-
7857

7958
# pylint:disable=missing-class-docstring
8059
class EighResult(NamedTuple):

dpnp/scipy/linalg/_decomp_lu.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@
5151
dpnp_lu_solve,
5252
)
5353

54-
__all__ = [
55-
"lu_factor",
56-
"lu_solve",
57-
]
58-
5954

6055
def lu_factor(a, overwrite_a=False, check_finite=True):
6156
"""

dpnp/scipy/linalg/_utils.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@
5151
from dpnp.dpnp_utils import get_usm_allocations
5252
from dpnp.linalg.dpnp_utils_linalg import _common_type
5353

54-
__all__ = [
55-
"dpnp_lu_factor",
56-
"dpnp_lu_solve",
57-
]
58-
5954

6055
def _align_lu_solve_broadcast(lu, b):
6156
"""Align LU and RHS batch dimensions with SciPy-like rules."""

dpnp/scipy/special/_erf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
import dpnp.backend.extensions.ufunc._ufunc_impl as ufi
4545
from dpnp.dpnp_algo.dpnp_elementwise_common import DPNPUnaryFunc
4646

47-
__all__ = ["erf", "erfc", "erfcinv", "erfcx", "erfinv"]
48-
4947

5048
# pylint: disable=too-few-public-methods
5149
class DPNPErf(DPNPUnaryFunc):

0 commit comments

Comments
 (0)