Repository navigation
Conversation
Annotate fn and user_data on host_launch and on the callback methods of GraphBuilder, GraphNode, and GraphDefinition. Drop cuda_bindings from the script dependencies of the host_launch example, which does not import it. Follow-up to review comments on NVIDIA#3258. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Findings
|
| Layer / File(s) | Summary |
|---|---|
Host launch annotations cuda_core/cuda/core/_launcher.pyi, cuda_core/cuda/core/_launcher.pyx, cuda_core/examples/host_launch.py |
host_launch now annotates fn and user_data. The example dependency list removes cuda_bindings and retains cuda_core. |
Graph callback annotations cuda_core/cuda/core/graph/_graph_builder.*, cuda_core/cuda/core/graph/_graph_definition.*, cuda_core/cuda/core/graph/_graph_node.* |
GraphBuilder.callback, GraphDefinition.callback, and GraphNode.callback now annotate fn and user_data. Their implementations remain unchanged. |
Possibly related issues
- NVIDIA/cuda-python issue 3256: The PR updates the
host_launchcallable anduser_datatypes, but does not add the compiled copy callback described in the issue. - NVIDIA/cuda-python issue 2058: The PR adds type annotations to the existing host callback APIs, but does not change or add runtime API behavior.
Suggested reviewers: mdboom
Change: Other
Merge Risk: 
Moderate · up to f80b7
-
The host-launch example may fail before it starts in an isolated script environment. Declare a compatible CUDA extra before merging.
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: NVIDIA/cuda-python
- Branch: main
- File: .coderabbit.yaml
- Commit: 230f0eb
- Layers: Repository YAML
- Review profile: CHILL
- Plan: Enterprise
- Run ID:
e8b6e8de-f51c-4d79-827d-6cf1c9d0a936
Files selected for processing: 9-
cuda_core/cuda/core/_launcher.pyicuda_core/cuda/core/_launcher.pyxcuda_core/cuda/core/graph/_graph_builder.pyicuda_core/cuda/core/graph/_graph_builder.pyxcuda_core/cuda/core/graph/_graph_definition.pyicuda_core/cuda/core/graph/_graph_definition.pyxcuda_core/cuda/core/graph/_graph_node.pyicuda_core/cuda/core/graph/_graph_node.pyxcuda_core/examples/host_launch.py
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.
-
|
|
||
| # /// script | ||
| # dependencies = ["cuda_bindings", "cuda_core"] | ||
| # dependencies = ["cuda_core"] |
There was a problem hiding this comment.
important: Restore the example’s runtime dependencies.
In an isolated script environment, cuda_core alone does not install cuda-bindings, and importing cuda.core raises ImportError. Select a compatible extra such as cuda_core[cu12] or cuda_core[cu13]. (raw.githubusercontent.com)
There was a problem hiding this comment.
This change originated from this comment. @mdboom do you agree with coderabbit that the cuda_bindings dependency is required after all?
|
Summary
Addresses the review nits on #3258. The host callback APIs now carry type annotations for
fnanduser_data, and thehost_launchexample no longer listscuda_bindingsas a dependency. The annotations do not change runtime behavior.Changes
host_launch,GraphBuilder.callback,GraphNode.callback,GraphDefinition.callback: annotatefn: Callable[..., object]anduser_data: int | BufferProtocol | None, matching theBufferProtocolalias thatBuffer.filluses. Regenerated the.pyistubs.examples/host_launch.py: removecuda_bindingsfrom the script dependencies, since the example does not import it.Related Work
Related to #3258.
🤖 Generated with Claude Code