bazel-contrib / bazel-contrib/rules_python

Smooth IDE support for python_rules

未关闭
#1,401 13 条评论 20 个 reaction 已指派 0 人 在 GitHub 查看
type: feature request type: pip
主要语言
Starlark
星标
688
派生
721
平均合并
15 小时 7 分钟
30 天内合并 PR
76

描述

# 🚀 feature request

### Description

I would like smooth editor support of the python_rules. Now when I open an editor (tried [helix](https://helix-editor.com/) 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](https://github.com/bazelbuild/rules_go/wiki/Editor-and-tool-integration) 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](https://github.com/astral-sh/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..

贡献指南

打开贡献指南

调研方向

首先查看 issue 中链接的 rules_go 编辑器和工具集成,然后比较 pyright 和 ruff-lsp 如何发现第三方 Python 导入以及由 Bazel 生成的 Python 导入。完成标准是提供一个有文档记录且可重复的编辑器集成,支持依赖项类型检查、自动补全和生成的 protobuf 代码,而无需手动创建匹配的虚拟环境。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
build-system, developer-experience, tooling
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
活跃
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。