Repository navigation
refactor(create): keep pure-Python operator sources in operators/<op>/ - #296
Merged
Merged
Conversation
Signed-off-by: Tom Birdsong <tbirdsong@nvidia.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
tbirdso
reviewed
Nov 6, 2026
…ith OP_<name> Signed-off-by: Tom Birdsong <tbirdsong@nvidia.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
tbirdso
reviewed
Nov 6, 2026
Signed-off-by: Tom Birdsong <tbirdsong@nvidia.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
wyli
reviewed
Nov 8, 2026
wyli
left a comment
Collaborator
There was a problem hiding this comment.
Checked at 8bfa3d1. Unit tests pass, and an end-to-end run on a GPU host with holoscan:v5.0.0-cuda13 passed for both a cpp python and a --language python Module: create, build, run, CTest, install --dev, the WHEEL package, and the wheel consumer. Locally, the staging, the install component, the wheel contents, OP_<op>=OFF, and restaging after adding, renaming, or deleting an operator all behave as described.
One fix is needed before merge; see the inline comment. Type checkers no longer see the operators.
Signed-off-by: Tom Birdsong <tbirdsong@nvidia.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
wyli
approved these changes
Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves the pure-Python Module (
holoscan create --language python, #284) operator source next to its metadata. Each operator is gated onOP_<name>throughadd_holohub_operator(), as C++ operators are. The layout now matches the C++ and 4.x templates:python/holoscan_<slug>/keeps only__init__.pyandpy.typed. Imports don't change:from holoscan_<slug>.operators import <Op>andimport holoscan.<slug>both still work.holoscan_<slug>_add_python_operator()(python/CMakeLists.txt) stages the callingoperators/<op>/sources asholoscan_<slug>.operators.<op>. Only operators whoseOP_<op>is ON are staged. Each configure clears earlier staged operators.cpp pythonwheel does:CMakeLists.txtno longer returns early forSKBUILD. Dist-info is written only for non-wheel builds, because scikit-build-core supplies its own.pip install --no-build-isolation -Ceditable.rebuild=true -e .(afterpip install scikit-build-core~=1.0.3 cmake ninja). The package re-stages enabled operators on import, at a cost of about 0.2 s per import.editable.rebuildis passed on the command line, not set inpyproject.toml. With build isolation, the rebuild can't find the isolatedninjaand the import fails. Passing the flag keeps a plainpip install -e .working, as a copy.operators/__init__.pyexports every staged operator package at runtime usingpkgutil, so disabling an operator needs no edit there. It also has oneif TYPE_CHECKING:import per operator (from .<op> import <Op> as <Op>), so mypy, pyright and IDEs resolve the exports.createand the post-gen hook point atoperators/andoperators/<op>/<op>.py.cppandcpp pythonoutput is unchanged apart from the CLI version pin.Verification
-DOP_my_mod_op=OFFand asserts nothing is staged. Pre-commit passes on changed files.cppandcpp pythonModules withmainand with this branch, then diffed: identical apart from theholoscan-cli==pin.--language pythonModule inholoscan:v5.0.0-cuda13(no GPU, stub libcuda), using a CLI wheel built from this branch:buildandrun --localreceived 10 samples; stagedoperators/my_module_op/test --localinstall --dev --localfrom holoscan.my_module.operators import MyModuleOpworkedpackage --pkg-generator WHEELpy3-none-anywheel withoperators/my_module_op/{__init__,my_module_op}.pyand nometadata.jsonpip wheel . -Ccmake.define.OP_my_module_op=OFFoperators/__init__.pypip check,pytest tests/pythonfrom holoscan_my_module.operators import MyModuleOpMyModuleOpmy_module_op.py-Ccmake.define.OP_my_module_op=OFFpip install -e .ruff check/ruff format --checkon the generated Modulewyli also ran a GPU end-to-end check at 8bfa3d1 for both
cpp pythonand--language pythonModules; see his review comment.Link to Devin session: https://nvidia-cloud.devinenterprise.com/sessions/e2d0e9d75b0b42f295b43491ae274a9d
Open in Devin Desktop: https://nvidia-cloud.devinenterprise.com/desktop/session/e2d0e9d75b0b42f295b43491ae274a9d?variant=devin