Skip to content

Conversation

antonwolfy
Copy link
Contributor

@antonwolfy antonwolfy commented Oct 6, 2025

The PR reworks the import of linalg submodule to avoid a wildcard import.

Also it resolves the issue reported by pylint:

Cyclic import (dpnp.linalg -> dpnp.linalg.dpnp_iface_linalg -> dpnp.linalg.dpnp_utils_linalg) (cyclic-import)

and moves LinAlgError exception to be exposed by LAPACK pybind11 extension, because it is created there.
While later the exception patched at python level to be set to "dpnp.linalg" submodule explicitly.

Otherwise we have the import cycle like:

linalg/init.py -> dpnp_iface_linalg.py -> dpnp_utils_linalg.py -> linalg/init.py

which might cause the import failure.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?

@antonwolfy antonwolfy added this to the 0.19.0 release milestone Oct 6, 2025
@antonwolfy antonwolfy self-assigned this Oct 6, 2025
@antonwolfy antonwolfy marked this pull request as ready for review October 6, 2025 12:53
Copy link
Contributor

github-actions bot commented Oct 6, 2025

View rendered docs @ https://intelpython.github.io/dpnp/index.html

Copy link
Contributor

github-actions bot commented Oct 6, 2025

Array API standard conformance tests for dpnp=0.19.0rc0=py313h509198e_11 ran successfully.
Passed: 1227
Failed: 0
Skipped: 9

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 72.0% (+0.002%) from 71.998%
when pulling 3eee5be on resolve-linalg-cyclic-import
into 2bdbd05 on master.

Copy link
Contributor

@vlad-perevezentsev vlad-perevezentsev left a comment

Choose a reason for hiding this comment

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

LGTM!
Thank you @antonwolfy !!!

@antonwolfy antonwolfy merged commit 285c313 into master Oct 6, 2025
97 of 98 checks passed
@antonwolfy antonwolfy deleted the resolve-linalg-cyclic-import branch October 6, 2025 15:47
antonwolfy added a commit that referenced this pull request Oct 6, 2025
The PR reworks the import of `linalg` submodule to avoid a wildcard
import.

Also it resolves the issue reported by pylint:
> Cyclic import (dpnp.linalg -> dpnp.linalg.dpnp_iface_linalg ->
dpnp.linalg.dpnp_utils_linalg) (cyclic-import)

and moves `LinAlgError` exception to be exposed by LAPACK pybind11
extension, because it is created there.
While later the exception patched at python level to be set to
"dpnp.linalg" submodule explicitly.

Otherwise we have the import cycle like:
> linalg/__init__.py -> dpnp_iface_linalg.py -> dpnp_utils_linalg.py ->
linalg/__init__.py

which might cause the import failure.
antonwolfy added a commit that referenced this pull request Oct 6, 2025
The PR reworks the import of `linalg` submodule to avoid a wildcard
import.

Also it resolves the issue reported by pylint:
> Cyclic import (dpnp.linalg -> dpnp.linalg.dpnp_iface_linalg ->
dpnp.linalg.dpnp_utils_linalg) (cyclic-import)

and moves `LinAlgError` exception to be exposed by LAPACK pybind11
extension, because it is created there.
While later the exception patched at python level to be set to
"dpnp.linalg" submodule explicitly.

Otherwise we have the import cycle like:
> linalg/__init__.py -> dpnp_iface_linalg.py -> dpnp_utils_linalg.py ->
linalg/__init__.py

which might cause the import failure.
@antonwolfy antonwolfy mentioned this pull request Oct 6, 2025
7 tasks
github-actions bot added a commit that referenced this pull request Oct 6, 2025
The PR reworks the import of `linalg` submodule to avoid a wildcard
import.

Also it resolves the issue reported by pylint:
> Cyclic import (dpnp.linalg -> dpnp.linalg.dpnp_iface_linalg ->
dpnp.linalg.dpnp_utils_linalg) (cyclic-import)

and moves `LinAlgError` exception to be exposed by LAPACK pybind11
extension, because it is created there.
While later the exception patched at python level to be set to
"dpnp.linalg" submodule explicitly.

Otherwise we have the import cycle like:
> linalg/__init__.py -> dpnp_iface_linalg.py -> dpnp_utils_linalg.py ->
linalg/__init__.py

which might cause the import failure. 285c313
antonwolfy added a commit that referenced this pull request Oct 6, 2025
This PR backports of #2608 from development branch to
`maintenance/0.19.x`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants