Errors in followed imports cause crash without a way to ignore unless import following is entirely disabled
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 54
説明
I think related to https://github.com/python/mypy/issues/6897 which was closed, but I often want to enable type checking on a module that imports a number of 3p packages that I have no control over.
However, I am finding that the import-following behavior for mypy is quite sensitive to things that I can't really control or easily ignore. I would expect that --follow-imports=silent would gracefully degrade in situations where this happens, but I find many cases where a stray comment (e.g. # type: some comment that's not actually a type specification) will cause a syntax error that causes the whole execution to error, and I can't find a way to ignore it without completely disabling --follow-imports.
I've encountered this with stray comments in tensorflow, for example. Is there any way to more gracefully fallback and recover from these kinds of errors in mypy? Or at least allow more fine-grained control on import following to not fail on syntax errors for specific external modules?
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、mypy の --follow-imports=silent オプションと、報告された TensorFlow のケースのように、余計な型のようなコメントを含むインポートされたサードパーティモジュールを使って、失敗を再現します。追跡対象の import で構文エラーがどのように処理されるかを追跡します。外部 import のエラーを回復可能にするか、import の追跡自体を完全に無効化せず、よりきめ細かな制御で無視できるようになれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100