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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smooth IDE support for python_rules #1401

Open
RmStorm opened this issue Sep 4, 2023 · 3 comments
Open

Smooth IDE support for python_rules #1401

RmStorm opened this issue Sep 4, 2023 · 3 comments

Comments

@RmStorm
Copy link

RmStorm commented Sep 4, 2023

馃殌 feature request

Description

I would like smooth editor support of the python_rules. Now when I open an editor (tried helix and vscode) neither recognizes any of the third party imports properly breaking autocomplete and type checking.

Describe the solution you'd like

Something like what the rules_go people have done but I imagine that pyright (the most commonly used python language server) does not have support for something similar to the gopackagedriver.. So I was thinking more along the lines of a shell script that manipulates PATH and PYTHONPATH to achieve something similar. still hacky but better than what I have now. It's also something that would work for other python language server's such as ruff-lsp.

Describe alternatives you've considered

Manually make a venv with the same dependencies and activate that before starting my editor. Works fine but it's hackish and it won't work for generated code. For example python files generated from protobuf by Bazel..

@aignas
Copy link
Collaborator

aignas commented Sep 21, 2023

Note, that pyright is a static type checker https://github.com/microsoft/pyright. Pylense is a closed-source LSP that is only available within VSCode.

For now you could use https://github.com/cedarai/rules_pyvenv to create a virtual environment for a target, that provides good editor integration. That may work with generated code.

@alexeagle
Copy link
Collaborator

https://github.com/aspect-build/rules_py has the explicit goal of providing excellent Python IDE support for py_* rules.

Copy link

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days.
Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_python!

@github-actions github-actions bot added the Can Close? Will close in 30 days if there is no new activity label Mar 30, 2024
@aignas aignas added type: feature request type: pip and removed Can Close? Will close in 30 days if there is no new activity labels Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants