Skip to content

Conversation

@AngryLoki
Copy link
Contributor

Problem solved by the commit

Right now all usage of pyxrt either not validated or causes type errors (when checking with any modern type-checking tool like pyright/pylance). There is no autocomplete either.

Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered

N/A

How problem was solved, alternative solutions (if any) and why they were rejected

This pull-request adds pyxrt.pyi type stub file with complete type annotations for the pyxrt module and installs it alongside the compiled extension module. The file covers the whole module verbatim, not trying to remove any duplicate definitions.

Risks (if any) associated the changes in the commit

pyxrt.pyi may desync with C++ code in the future, but it should not break anything other than type checking. This file is needed for IDE autocompletion and type checking and does not affect execution (at all).

What has been tested and how, request additional testing if necessary

Checked against current usage in mlir-aie iron with Python >= 3.11.

Documentation impact (if any)

N/A

@xrt-pr-bot
Copy link

xrt-pr-bot bot commented Dec 13, 2025

⚠️ Authorization Failed

@AngryLoki is not a repository collaborator.

To proceed:

  • XRT Admins: Add the build label to authorize this PR build
  • OR Add @AngryLoki as a repository collaborator

@stsoe stsoe added the build label Dec 29, 2025
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@sonals
Copy link
Member

sonals commented Jan 22, 2026

@AngryLoki, this is a great feature for Python users and code analyzers -- but please drop the usage of numpy.

Add pyxrt.pyi type stub file with complete type annotations for the pyxrt module and install it alongside the compiled extension module.

This file is needed for IDE autocompletion and type checking and does not affect execution.
Also update methods that were changed recently.
@AngryLoki
Copy link
Contributor Author

@AngryLoki, this is a great feature for Python users and code analyzers -- but please drop the usage of numpy.

Updated. Actually, not dropped numpy, but wrapped with try: except ImportError:. Why it is needed - because bindings use py::array_t. I think now it is safe (now I also partially checked with Python 3.9 + no numpy). Python 3.12+ has ReadableBuffer, with lower versions a bunch of not very beautiful code required.

@sonals sonals merged commit 03d5c90 into Xilinx:master Feb 9, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants