Skip to content

Conversation

@zacharyvincze
Copy link
Contributor

Motivation

  • Restructures the rocpycv install to ensure that no double import occurs (e.g. rocpycv.rocpycv.Tensor)

Technical Details

  • Updates python stubs with the double import fix.
  • Updates CMake files to ensure the RPATH points to the proper relative directories based on the new origin of the .so files.

Test Plan

  • Ensure python tests remain installed properly, and that those tests pass.
  • Ensure python stubs are detected, as they have a new install location.

Test Result

  • Python tests pass and pystubs are detected properly.

Submission Checklist

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request restructures the rocpycv Python package installation to eliminate the double import issue where users previously had to write rocpycv.rocpycv.Tensor instead of rocpycv.Tensor.

Changes:

  • Removed the nested rocpycv/ subdirectory structure by deleting __init__.py and __init__.pyi wrapper files
  • Moved the type stub file to install directly alongside the compiled module
  • Updated CMake install paths from lib/rocpycv/rocpycv.so to lib/rocpycv.so
  • Updated RPATH configuration to match the new installation location
  • Updated test detection to look for the stub file in the new location

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
python/src/rocpycv/init.py Removed wrapper file that caused double import
python/src/rocpycv/init.pyi Removed type stub wrapper that caused double import
python/src/rocpycv.pyi Updated type stub with new structure (entire file regenerated)
python/CMakeLists.txt Updated install paths and RPATH to install module directly in lib/
tests/pybind/CMakeLists.txt Updated test detection path for the relocated stub file
Comments suppressed due to low confidence (15)

python/src/rocpycv.pyi:806

  • The documentation for the stream parameter incorrectly describes flip code behavior ("0 flips along the x-axis, positive integer flips along the y-axis, and negative integers flip along both axis"). This description belongs to the flip operation, not to the stream parameter. The stream parameter should be documented as the HIP stream to run this operation on.
    python/src/rocpycv.pyi:904
  • The documentation for the custom_crop function returns None according to the docstring but the function signature shows it returns a Tensor. The Returns section should state "rocpycv.Tensor: The output tensor" instead of "None".
    python/src/rocpycv.pyi:982
  • The documentation for the stream parameter incorrectly describes flip code behavior ("0 flips along the x-axis, positive integer flips along the y-axis, and negative integers flip along both axis"). This description belongs to the flip_code parameter, not to the stream parameter. The stream parameter should be documented as the HIP stream to run this operation on.
    python/src/rocpycv.pyi:897
  • The documentation incorrectly references a dst parameter that doesn't exist in the function signature. The custom_crop function only has src, crop_rect, stream, and device parameters. This documentation should be updated to reflect the actual function signature.
    python/src/rocpycv.pyi:914
  • The documentation incorrectly references a dst parameter that doesn't exist in the function signature. The custom_crop_into function has dst, src, crop_rect, stream, and device parameters, but the Args section is missing the dst parameter and incorrectly starts with src.
    python/src/rocpycv.pyi:965
  • The documentation for the stream parameter incorrectly describes flip code behavior ("0 flips along the x-axis, positive integer flips along the y-axis, and negative integers flip along both axis"). This description belongs to the flip_code parameter, not to the stream parameter. The stream parameter should be documented as the HIP stream to run this operation on.
    python/src/rocpycv.pyi:981
  • The documentation for the flip_code parameter is incomplete. It states "A flip code representing how images in the batch should be flipped." but ends abruptly without the actual explanation. The full description should explain that 0 flips along the x-axis, positive integer flips along the y-axis, and negative integers flip along both axes.
    python/src/rocpycv.pyi:786
  • The documentation incorrectly references a dst parameter that doesn't exist in the function signature. The center_crop function only has src, crop_size, stream, and device parameters. This documentation should be updated to reflect the actual function signature.
    python/src/rocpycv.pyi:900
  • The documentation for the stream parameter incorrectly describes flip code behavior ("0 flips along the x-axis, positive integer flips along the y-axis, and negative integers flip along both axis"). This description belongs to the flip operation, not to the stream parameter. The stream parameter should be documented as the HIP stream to run this operation on.
    python/src/rocpycv.pyi:916
  • The documentation for the stream parameter incorrectly describes flip code behavior ("0 flips along the x-axis, positive integer flips along the y-axis, and negative integers flip along both axis"). This description belongs to the flip operation, not to the stream parameter. The stream parameter should be documented as the HIP stream to run this operation on.
    python/src/rocpycv.pyi:161
  • The stub file uses typing_extensions.CapsuleType but does not import typing_extensions. This will cause a NameError when type checkers or IDEs try to parse this stub file. Add import typing_extensions to the imports at the top of the file.
    python/src/rocpycv.pyi:789
  • The documentation for the stream parameter incorrectly describes flip code behavior ("0 flips along the x-axis, positive integer flips along the y-axis, and negative integers flip along both axis"). This description belongs to the flip operation, not to the stream parameter. The stream parameter should be documented as the HIP stream to run this operation on.
    python/src/rocpycv.pyi:920
  • The documentation is incorrect. The custom_crop_into function returns None, not a Tensor. The Returns section should state "None" instead of "rocpycv.Tensor: The output tensor."
    python/src/rocpycv.pyi:964
  • The documentation for the flip_code parameter is incomplete. It states "A flip code representing how images in the batch should be flipped." but ends abruptly without the actual explanation. The full description should explain that 0 flips along the x-axis, positive integer flips along the y-axis, and negative integers flip along both axes.
    python/src/rocpycv.pyi:704
  • The type annotations in function signatures should not use the rocpycv. prefix. Within a stub file for the rocpycv module, types should be referenced directly as Stream and Tensor instead of rocpycv.Stream and rocpycv.Tensor. This pattern appears throughout the file in all function signatures and should be corrected.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant