Disappearing dmypy errors using `--export-types`, `pip install -e`, and absolute paths
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Bug Report
Errors disappear on the second run of dmypy under specific circumstances:
- Dmypy is run using the
--export-typesflag. - We use absolute paths to the files checked.
- The files checked are in a project which has been installed with
pip install -e. - The files checked are in a
srcdirectory. (This is so odd that I feel as though I might have made a mistake here.)
This looks similar to https://github.com/python/mypy/issues/9655, but unlike that, this isn't fixed by https://github.com/python/mypy/pull/15043 (see https://github.com/python/mypy/pull/15043#issuecomment-1884022976).
To Reproduce
The best minimal example I have so far:
pyproject.toml:
[build-system]
requires = ["setuptools >= 64"]
build-backend = "setuptools.build_meta"
[project]
name = "dmypy_example"
version = "0.0.1"
dependencies = []
src/foo.py:
a: str = 1
Commands:
# Create a new Python 3.12 virtualenv, then:
pip install --editable .
dmypy run --export-types $(pwd)/src/foo.py
dmypy run --export-types $(pwd)/src/foo.py
Expected Behavior
We should see the same error output after both runs of dmypy.
Actual Behavior
Regardless of the error in the file, it disappears on the second run of dmypy.
$ pip install --editable .
...
$ dmypy run --export-types $(pwd)/src/foo.py
Daemon started
src/foo.py:1: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment]
Found 1 error in 1 file (checked 1 source file)
$ dmypy run --export-types $(pwd)/src/foo.py
Success: no issues found in 1 source file
Your Environment
- Mypy configuration options from
mypy.ini(and other config files): None. - Python version used: 3.12.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
pyproject.toml と src/foo.py の最小限の例から始め、pip install --editable . でインストールし、2つの dmypy コマンドを表示されているとおりに正確に実行します。--export-types、absolute-path、editable-install、src-directory の組み合わせを追跡しながら、daemon の1回目と2回目の結果を比較します。両方の実行で型エラーが表示されたままであれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100