Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code completion with Python bindings? #8112

Open
ziriax opened this issue Feb 19, 2024 · 3 comments
Open

Code completion with Python bindings? #8112

ziriax opened this issue Feb 19, 2024 · 3 comments

Comments

@ziriax
Copy link

ziriax commented Feb 19, 2024

I was trying out the Python bindings using Ubuntu 23.10 and the Halide16 apt packages in a Docker container with a VSCode remote connection, but I wasn't able to get code completion working.

My code did run fine, it was just the VSCode IDE that showed all kinds of errors because it didn't find the halide symbols.

Is this supposed to work correctly, or is this not supported.

@steven-johnson
Copy link
Contributor

I'm not aware that any of the Halide core contributors have ever looked into making this work, so, yeah, it's probably nt working.

We'd be happy for someone else to do so and submit a PR, of course :-)

@lirenzhucn
Copy link

I was doing some quick experimentation just today on this! In short, pybind11 generated python bindings don't work with standard Python tools like pyright (VSCode's default lsp) or mypy.

I tried pybind11-stubgen with some success. Basically, after installing it, you run something like:

pybin11-stubgen halide -o path/to/site-packages

Assuming halide is installed under path/to/site-packages.

This will generate a few .pyi stub files and place them next to the installed halide files. Many things are still not working, though. But based on a quick look at this discussion on pybind11, some tweaks in halide's python bindings code will really help.

@steven-johnson
Copy link
Contributor

some tweaks in halide's python bindings code will really help.

At the moment we don't have any resources available to work on this, but we'd be very happy to review any PRs that improve the Python bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants