python / python/mypy

Do not check LSP compatibility of `plugin_generated` nodes

オープン
#20,008 コメント 4 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature topic-plugins
主要言語
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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、mypy の LSP 互換性チェックと、プラグインが生成したノードがどのように表現されるかを追跡します。プラグインがこれらのチェックを手動で実行するために必要な checker API を定義し、プラグインが生成したオーバーライドでは自動の LSP 診断が発生せず、通常のオーバーライドは引き続きチェックされることを示すカバレッジを追加します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
compilers, devtools
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。