Do not check LSP compatibility of `plugin_generated` nodes
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 20.6k
- 派生
- 3.3k
- PR 合并指标
- PR 指标待抓取
描述
Feature
When plugins add some methods or variables, it should be their responsibility to decide whether the override should be checked for LSP compat.
Pitch
This is already hitting the pydantic plugin, for example, resulting in some very weird workaround involving adding an unresolved classmethod decorator that shouldn't be there at all.
In many cases a plugin-generated method has narrower signature than the base class definition, and there is no way to make it compatible with super definition (which can't be removed either to support other typecheckers). We still want a plugin to be able to define such a signature without introducing noise, assuming that the plugin author is already aware that such behavior violates LSP.
It should become easy to run LSP checks manually from plugin code. Checker API should be extended to include the necessary methods, or we'll see increased use of mypy internals or unexpectedly omitting LSP checks altogether because they are too tricky to implement correctly.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先跟踪 mypy 的 LSP 兼容性检查,以及插件生成的节点是如何表示的。定义插件运行这些检查所需的 checker API,并添加测试覆盖,表明插件生成的重写不会触发自动 LSP 诊断,而普通重写仍会接受检查。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- compilers, devtools
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100