python / python/mypy

Mypy does not recheck files when follow_imports changes for dependencies

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

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

bug priority-0-high topic-fine-grained-incremental
主要言語
Python
スター
20.6k
フォーク
3.3k
PR マージ指標
PR 指標を取得中

説明

Steps to reproduce
  1. Create module test.py with import from nonexistent module:
from foo import bar
  1. Create mypy.ini file:
[mypy]

[mypy-foo]
ignore_missing_imports = True 
  1. Run mypy
$ mypy test.py 
Success: no issues found in 1 source file
  1. Comment out [mypy-foo] section in mypy.ini
[mypy]

# [mypy-foo]
# ignore_missing_imports = True 
  1. Run mypy
$ mypy test.py 
Success: no issues found in 1 source file
Expected result

After step 4, mypy should detect config change and (partially?) invalidate cache, leading to a type error.

$ mypy test.py 
test.py:1: error: Cannot find module named 'foo'
test.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
Notes
  • Deleting .mypy_cache/ and re-running mypy fixes the issue.
  • Adding/removing ignore_missing_imports in the main [mypy] section does seem to invalidate the cache as expected. So this issue only seems to apply to [mypy-PATTERN] sections.
Versions
$ python --version
Python 3.7.3
$ mypy --version
mypy 0.740

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

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

はじめの一歩

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

調査の方向性

示されている設定手順を使って、test.py、mypy.ini、および .mypy_cache/ ディレクトリで問題を再現します。まず、[mypy-PATTERN] セクションのキャッシュ無効化を追跡し、メインの [mypy] セクションの変更と比較します。パターンセクションを変更すると、キャッシュを手動で削除しなくても、mypy が欠落している foo モジュールを報告するようになれば完了です。

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

評価

技術スタック
python
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
48/100

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

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