Skip to content

Deprecate unused dpnp.config settings - #3107

Open
antonwolfy wants to merge 2 commits into
masterfrom
deprecate-unused-config
Open

antonwolfy wants to merge 2 commits into
masterfrom
deprecate-unused-config

Conversation

@antonwolfy

Copy link
Copy Markdown
Contributor

dpnp.config defines __DPNP_QUEUE_GPU__, __DPNP_OUTPUT_NUMPY__ and __DPNP_OUTPUT_DPCTL_DEFAULT_SHARED__, read from the DPNP_QUEUE_GPU, DPNP_OUTPUT_NUMPY and DPNP_OUTPUT_DPCTL_DEFAULT_SHARED environment variables, but nothing in dpnp uses them, so setting those variables has no effect.

This PR deprecates the three attributes before removing them: they are no longer module attributes but are served by a module-level __getattr__, which returns the same value as before (still read from the environment at import) and emits a DeprecationWarning:

`dpnp.config.__DPNP_OUTPUT_NUMPY__` is deprecated, and will be removed in a future release. It has no effect.

Any other unknown name still raises AttributeError. They can be removed in a future release by deleting _DEPRECATED_SETTINGS and __getattr__.

__DPNP_ORIGIN__ and __DPNP_RAISE_EXCEPION_ON_NUMPY_FALLBACK__ are still used and are not changed. The test suite's own use of the DPNP_QUEUE_GPU environment variable, which dpnp/tests/conftest.py reads directly to pick the GPU skip list, is not affected.

The new dpnp/tests/test_config.py checks that each deprecated attribute warns and returns its value, and that an unknown name raises AttributeError. Importing dpnp emits no warning, and the warning points at the caller's line.

  • 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?

__DPNP_QUEUE_GPU__, __DPNP_OUTPUT_NUMPY__ and
__DPNP_OUTPUT_DPCTL_DEFAULT_SHARED__ are not used anywhere in dpnp.
Reading them now emits a DeprecationWarning; they will be removed in a
future release.
@antonwolfy antonwolfy self-assigned this Oct 15, 2026
@antonwolfy antonwolfy added this to the 0.21.0 release milestone Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

Array API standard conformance tests for dpnp=0.21.0dev14=np2py314h8d9cdd5_6 ran successfully.
Passed: 1376
Failed: 0
Skipped: 6

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Status

No base build to compare — deprecate-unused-config into master

This branch has not been deployed

No deployments
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.

2 participants