Skip to content

refactor(pathfinder): privatize optional_cuda_import#1742

Merged
cpcloud merged 3 commits intoNVIDIA:mainfrom
cpcloud:privatize-optional-cuda-import
Mar 9, 2026
Merged

refactor(pathfinder): privatize optional_cuda_import#1742
cpcloud merged 3 commits intoNVIDIA:mainfrom
cpcloud:privatize-optional-cuda-import

Conversation

@cpcloud
Copy link
Contributor

@cpcloud cpcloud commented Mar 9, 2026

Summary

  • Rename optional_cuda_import to _optional_cuda_import to remove it from the public API surface, since it is an internal helper used only by cuda.core.
  • Update all call sites in cuda_core (_linker.pyx, _program.pyx) and their tests to use the private name.
  • Remove optional_cuda_import from the Sphinx API docs.

Test plan

  • Existing test_optional_cuda_import.py tests pass (pathfinder)
  • Existing test_optional_dependency_imports.py tests pass (cuda_core)

Made with Cursor

Rename `optional_cuda_import` to `_optional_cuda_import` to remove it
from the public API surface. It is an internal helper used only by
`cuda.core` and should not be part of the stable public interface.

Made-with: Cursor
@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Mar 9, 2026

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

Python modules. It returns ``None`` when the requested module is absent or a
probe hits ``DynamicLibNotFoundError``, while still re-raising unrelated
``ModuleNotFoundError`` exceptions (for missing transitive dependencies).
* Add ``_optional_cuda_import()`` (private helper) to support robust optional
Copy link
Member

Choose a reason for hiding this comment

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

Q: If it's private do we still want to document it?

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 not!

@leofang leofang added the cuda.pathfinder Everything related to the cuda.pathfinder module label Mar 9, 2026
@cpcloud
Copy link
Contributor Author

cpcloud commented Mar 9, 2026

/ok to test

@cpcloud cpcloud enabled auto-merge (squash) March 9, 2026 21:01
@cpcloud cpcloud disabled auto-merge March 9, 2026 21:01
@github-actions

This comment has been minimized.

The re-export shadowed the `_optional_cuda_import` submodule with the
function of the same name, breaking `import ... as` in tests. Import
directly from the submodule in consumers instead.

Made-with: Cursor
@cpcloud
Copy link
Contributor Author

cpcloud commented Mar 9, 2026

/ok to test

@cpcloud cpcloud enabled auto-merge (squash) March 9, 2026 21:28
@cpcloud cpcloud merged commit 6909d36 into NVIDIA:main Mar 9, 2026
86 checks passed
@github-actions

This comment has been minimized.

@cpcloud cpcloud deleted the privatize-optional-cuda-import branch March 9, 2026 22:49
@github-actions
Copy link

Doc Preview CI
Preview removed because the pull request was closed or merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.pathfinder Everything related to the cuda.pathfinder module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants