Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
39d2ee9
Move array creation exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
75bfb02
Move binary operations exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
bcb3697
Move couting function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
ca4e526
Move functional function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
804098f
Move histogram function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
36c9173
Move indexing function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
f20bdc5
Move linear algebra function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
bebfc84
Move logic function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
defce44
Move manipulation function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
9914214
Move mathematical function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
c152d7b
Move nan function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
6d58414
Move searching function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
fbb7b82
Move sorting function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
a92158a
Move statistics function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
9c96ced
Move trigonometric function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
490c4ef
Move window function exports from dpnp_iface.py to __init__.py
vlad-perevezentsev Nov 12, 2025
68affb3
Merge master into refactor_public_api_exports
vlad-perevezentsev Nov 12, 2025
47d599e
Remove wildcard import dpnp_algo in dpnp_iface.py
vlad-perevezentsev Nov 12, 2025
382f144
Move dpnp_iface exports to __init__.py
vlad-perevezentsev Nov 12, 2025
b5d8308
Merge master into refactor_public_api_exports
vlad-perevezentsev Nov 13, 2025
80ea4fb
Remove unnecessary pylint disables
vlad-perevezentsev Nov 13, 2025
1ee5b5a
Return no-name-in-module pylint disable
vlad-perevezentsev Nov 13, 2025
7cbc63a
Remove __all__ from dpnp_array_api_info.py
vlad-perevezentsev Nov 14, 2025
b8a4b73
Unify type exports in __init__.py and remove wildcard import
vlad-perevezentsev Nov 14, 2025
57fb9f3
Unify byte_bounds() export in __init__.py and remove wildcard import
vlad-perevezentsev Nov 14, 2025
723e2c1
Update changelog
vlad-perevezentsev Nov 14, 2025
3ee2076
Apply remarks
vlad-perevezentsev Nov 18, 2025
ebf3431
Remove pylint no-member disable
vlad-perevezentsev Nov 18, 2025
a9c5398
Add explicit __all__ exports to dpnp/__init__.py
vlad-perevezentsev Nov 18, 2025
bcb399f
Merge master into refactor_public_api_exports
vlad-perevezentsev Nov 18, 2025
1f3060e
Merge refactor_public_api_exports into clean_init_exports
vlad-perevezentsev Nov 18, 2025
21f9837
Expand __all__ in relation to new changes
vlad-perevezentsev Nov 18, 2025
afaf007
Apply remarks
vlad-perevezentsev Nov 18, 2025
244721b
Remove obsolete pre-commit disables
vlad-perevezentsev Nov 18, 2025
2bbd6de
Revert E501 flake ignore
vlad-perevezentsev Nov 18, 2025
7971b3b
Move is_type_supported() to dpnp_iface_random.py and remove from publ…
vlad-perevezentsev Nov 18, 2025
d591a57
Merge master into clean_init_exports
vlad-perevezentsev Dec 17, 2025
e17f107
Move flatiter import to indexing section
vlad-perevezentsev Dec 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ repos:
[
"-rn", # Only display messages
"-sn", # Don't display the score
"--disable=c-extension-no-member",
"--disable=import-error",
"--disable=redefined-builtin",
"--disable=unused-wildcard-import"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Also, that release drops support for Python 3.9, making Python 3.10 the minimum
* 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)
* Unified public API definitions in `dpnp.linalg` and `dpnp.scipy` submodules [#2663](https://github.com/IntelPython/dpnp/pull/2663)
* Aligned the signature of `dpnp.reshape` function with Python array API by making `shape` a required argument [#2673](https://github.com/IntelPython/dpnp/pull/2673)
* Unified `dpnp` public API exports by consolidating function exports in `__init__.py` and removing wildcard imports [#2665](https://github.com/IntelPython/dpnp/pull/2665) [#2666](https://github.com/IntelPython/dpnp/pull/2666)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove "--disable=c-extension-no-member" from .pre-commit-config.yaml now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And E501 skipping in .flake8

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably you meant F403 : ‘from module import *’ used
Since some files that are to be removed in the future still contain wildcard imports I would prefer not to change flake8 config

dpnp/dpnp_algo/__init__.py:29:1: F403 'from dpnp.dpnp_algo.dpnp_algo import *' used; unable to detect undefined names
from dpnp.dpnp_algo.dpnp_algo import *
^
dpnp/dpnp_utils/__init__.py:29:1: F403 'from dpnp.dpnp_utils.dpnp_algo_utils import *' used; unable to detect undefined names
from dpnp.dpnp_utils.dpnp_algo_utils import *
^
dpnp/random/dpnp_iface_random.py:44:1: F403 'from dpnp.dpnp_algo import *' used; unable to detect undefined names
from dpnp.dpnp_algo import *
^
dpnp/random/dpnp_iface_random.py:45:1: F403 'from dpnp.dpnp_utils import *' used; unable to detect undefined names
from dpnp.dpnp_utils import *
^
dpnp/random/dpnp_iface_random.py:47:1: F403 'from .dpnp_algo_random import *' used; unable to detect undefined names
from .dpnp_algo_random import *
^
5     F403 'from dpnp.dpnp_algo.dpnp_algo import *' used; unable to detect undefined names
5

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine to remove that in the follow up PR


### Deprecated

Expand Down
147 changes: 135 additions & 12 deletions dpnp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,55 @@

from .dpnp_array import dpnp_array as ndarray
from .dpnp_array_api_info import __array_namespace_info__
from .dpnp_flatiter import flatiter as flatiter
from .dpnp_iface_types import *
from .dpnp_iface_utils import *
from .dpnp_iface_utils import __all__ as _ifaceutils__all__
from ._version import get_versions
from . import exceptions as exceptions
from . import fft as fft
from . import linalg as linalg
from . import random as random
from . import scipy as scipy

# =============================================================================
# Data types
# =============================================================================
from .dpnp_iface_types import (
bool,
bool_,
byte,
cdouble,
complex128,
complex64,
complexfloating,
csingle,
double,
float16,
float32,
float64,
floating,
inexact,
int_,
int8,
int16,
int32,
int64,
integer,
intc,
intp,
longlong,
number,
short,
signedinteger,
single,
ubyte,
uint8,
uint16,
uint32,
uint64,
uintc,
uintp,
unsignedinteger,
ushort,
ulonglong,
)

# =============================================================================
# Routines
Expand All @@ -87,6 +125,18 @@
# https://numpy.org/doc/stable/reference/routines.html
# =============================================================================

# -----------------------------------------------------------------------------
# Constants
# -----------------------------------------------------------------------------
from .dpnp_iface_types import (
e,
euler_gamma,
inf,
nan,
newaxis,
pi,
)

# -----------------------------------------------------------------------------
# Array creation routines
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -144,7 +194,6 @@
atleast_3d,
broadcast_arrays,
broadcast_to,
can_cast,
column_stack,
concat,
concatenate,
Expand All @@ -169,7 +218,6 @@
require,
reshape,
resize,
result_type,
roll,
rollaxis,
rot90,
Expand Down Expand Up @@ -206,6 +254,19 @@
right_shift,
)

# -----------------------------------------------------------------------------
# Data type routines
# -----------------------------------------------------------------------------
from .dpnp_iface_types import (
common_type,
finfo,
iinfo,
isdtype,
issubdtype,
)
from .dpnp_iface_manipulation import can_cast, result_type
from .dpnp_iface_types import dtype

# -----------------------------------------------------------------------------
# Functional programming
# -----------------------------------------------------------------------------
Expand All @@ -226,7 +287,6 @@
diagonal,
extract,
fill_diagonal,
flatnonzero,
indices,
iterable,
ix_,
Expand All @@ -247,6 +307,7 @@
triu_indices_from,
unravel_index,
)
from .dpnp_flatiter import flatiter

# -----------------------------------------------------------------------------
# Linear algebra
Expand Down Expand Up @@ -423,6 +484,7 @@
# Miscellaneous routines
# -----------------------------------------------------------------------------
from .dpnp_iface_manipulation import broadcast_shapes
from .dpnp_iface_utils import byte_bounds
from .dpnp_iface import get_include

# -----------------------------------------------------------------------------
Expand All @@ -440,6 +502,7 @@
# Sorting, searching, and counting
# -----------------------------------------------------------------------------
from .dpnp_iface_counting import count_nonzero
from .dpnp_iface_indexing import flatnonzero
from .dpnp_iface_nanfunctions import nanargmax, nanargmin
from .dpnp_iface_searching import (
argmax,
Expand Down Expand Up @@ -529,6 +592,57 @@

__all__ = ["__array_namespace_info__", "ndarray"]

# Data types
__all__ = [
"bool",
"bool_",
"byte",
"cdouble",
"complex128",
"complex64",
"complexfloating",
"csingle",
"double",
"float16",
"float32",
"float64",
"floating",
"inexact",
"int_",
"int8",
"int16",
"int32",
"int64",
"integer",
"intc",
"intp",
"longlong",
"number",
"short",
"signedinteger",
"single",
"ubyte",
"uint8",
"uint16",
"uint32",
"uint64",
"uintc",
"uintp",
"unsignedinteger",
"ushort",
"ulonglong",
]

# Constants
__all__ += [
"e",
"euler_gamma",
"inf",
"nan",
"newaxis",
"pi",
]

# Array creation routines
__all__ += [
"arange",
Expand Down Expand Up @@ -582,7 +696,6 @@
"atleast_3d",
"broadcast_arrays",
"broadcast_to",
"can_cast",
"column_stack",
"concat",
"concatenate",
Expand All @@ -607,7 +720,6 @@
"require",
"reshape",
"resize",
"result_type",
"roll",
"rollaxis",
"rot90",
Expand Down Expand Up @@ -642,6 +754,18 @@
"right_shift",
]

# Data type routines
__all__ += [
"can_cast",
"common_type",
"dtype",
"finfo",
"iinfo",
"isdtype",
"issubdtype",
"result_type",
]

# Functional programming
__all__ += [
"apply_along_axis",
Expand All @@ -659,7 +783,6 @@
"extract",
"fill_diagonal",
"flatiter",
"flatnonzero",
"indices",
"iterable",
"ix_",
Expand Down Expand Up @@ -850,6 +973,7 @@
# Miscellaneous routines
__all__ += [
"broadcast_shapes",
"byte_bounds",
"get_include",
]

Expand All @@ -869,6 +993,7 @@
"argwhere",
"argsort",
"count_nonzero",
"flatnonzero",
"partition",
"searchsorted",
"sort",
Expand Down Expand Up @@ -933,8 +1058,6 @@
"synchronize_array_data",
]

__all__ += _ifaceutils__all__

# add submodules
__all__ += ["exceptions", "fft", "linalg", "random", "scipy"]

Expand Down
2 changes: 0 additions & 2 deletions dpnp/dpnp_array_api_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@

import dpctl.tensor as dpt

__all__ = ["__array_namespace_info__"]


def __array_namespace_info__():
"""
Expand Down
62 changes: 0 additions & 62 deletions dpnp/dpnp_iface_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,60 +47,6 @@
# pylint: disable=no-name-in-module
from .dpnp_utils import get_usm_allocations

__all__ = [
"bool",
"bool_",
"byte",
"cdouble",
"common_type",
"complex128",
"complex64",
"complexfloating",
"csingle",
"double",
"dtype",
"e",
"euler_gamma",
"finfo",
"float16",
"float32",
"float64",
"floating",
"iinfo",
"inexact",
"inf",
"int_",
"int8",
"int16",
"int32",
"int64",
"integer",
"intc",
"intp",
"isdtype",
"issubdtype",
"is_type_supported",
"longlong",
"nan",
"newaxis",
"number",
"pi",
"short",
"signedinteger",
"single",
"ubyte",
"uint8",
"uint16",
"uint32",
"uint64",
"uintc",
"uintp",
"unsignedinteger",
"ushort",
"ulonglong",
]


# pylint: disable=invalid-name
# =============================================================================
# Data types (borrowed from NumPy)
Expand Down Expand Up @@ -365,11 +311,3 @@ def issubdtype(arg1, arg2):
"""

return numpy.issubdtype(arg1, arg2)


def is_type_supported(obj_type):
"""Return True if type is supported by DPNP python level."""

if obj_type in (float64, float32, int64, int32):
return True
return False
2 changes: 0 additions & 2 deletions dpnp/dpnp_iface_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

import dpnp

__all__ = ["byte_bounds"]


def byte_bounds(a):
"""
Expand Down
Loading
Loading