python / python/mypy

Make type checking mypy more straightforward for new contributors

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

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

topic-developer topic-tests
主要言語
Python
スター
20.6k
フォーク
3.3k
PR マージ指標
PR 指標を取得中

説明

There are a couple pitfalls relating to type checking mypy itself that don't seem to be documented anywhere:

  1. Specifying files: Running mypy . and mypy mypy mypyc both result in duplicate module errors that prevent further type checking. The correct way to run mypy is mypy -p mypy -p mypyc, which doesn't appear to be documented anywhere (I only found this by looking at the tox.ini config file).
  2. Specifying the config file: Failing to specify mypy_self_check.ini as the config file results in an error in mypy/bogus_type.py and means that people aren't using mypy's stricter type checking options.

I think the solution to 2 would be to rename mypy_self_check.ini to mypy.ini, because self checking mypy is significantly more common than compiling mypy with mypyc, so making mypy_self_check.ini the default config file seems reasonable.

For 1, we should at the very least document the command to run mypy in CONTRIBUTING.md. I think the ideal solution would involve changing the configuration file so that either mypy . or mypy mypy mypyc just works correctly, the latter of which seems to be possible from my experiments by turning on namespace_packages and excluding mypyc/test-data.

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

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

はじめの一歩

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

調査の方向性

CONTRIBUTING.md と tox.ini から始め、文書化されている mypy コマンドと設定されている mypy コマンドを比較します。mypy_self_check.ini と mypy/bogus_type.py を調べ、その後、提案されている設定名または namespace packages の変更によって重複モジュールエラーを回避しつつ、厳密な自己チェックを維持できるかを確認します。コントリビューター向けのワークフローに信頼できるコマンドと設定が記載されていれば完了です。

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

評価

技術スタック
python
領域
build-system, developer-experience, documentation
issue の種類
ドキュメント
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

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

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