Incorrect diagnostic on missing submodule
オープン
まだ誰も着手していません。
bug
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Bug Report
When untyped module exists but submodule does not, mypy reports that submodule is installed.
To Reproduce
$ pip install fabric
import fabric
from fabric.not_exists import something
$ python3 test.py
Traceback (most recent call last):
File "/media/sf_d/WWPass/git/spm/test.py", line 2, in <module>
from fabric.not_exists import something
ModuleNotFoundError: No module named 'fabric.not_exists'
$ mypy test.py
test.py:1:1: error: Skipping analyzing "fabric": module is installed, but missing library stubs or py.typed marker [import-untyped]
import fabric
^
test.py:2:1: error: Skipping analyzing "fabric.not_exists": module is installed, but missing library stubs or py.typed marker [import-untyped]
from fabric.not_exists import something
^
test.py:2:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 2 errors in 1 file (checked 1 source file)
Expected Behavior
Error in line 2 should be saying that fabric.not_exists does not exist.
Actual Behavior
Error in line 2 says that fabric.not_exists is installed, which it not true and misleading.
Your Environment
$ mypy --version
mypy 1.11.2 (compiled: yes)
$ python3 --version
Python 3.12.3
$ pip list | grep fabric
fabric 3.2.2
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
示されている test.py、インストール済みの型付けされていない fabric パッケージ、そして fabric.not_exists のインポートを使って報告を再現してください。まず、mypy のインポート解決と、ネストされたモジュールに対するスタブ欠落の診断を追跡します。既存のパッケージが現在の警告を引き続き報告し、一方で存在しないサブモジュールには明確な does-not-exist エラーが出れば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100