python / python/mypy

Make cache more agnostic to venvs

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

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

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

説明

I noticed that the mypy cache will mark almost everything as stale if the cache was produced with a venv different from the one running mypy. I think this is due to a full path being placed into cache files & interface_hashes, for files that are stdlib or packages. Then those packages, and everything depending on them, gets invalidated (which ends up being 99% of everything in big projects). I think it would be cool if the cache were more agnostic to this, for two reasons:

  1. when testing locally, I occasionally use a second venv with maybe 1 or 2 different packages to test out changes (maybe a package upgraded or added types). Ideally only those packages and their descendants would be invalidated.
  2. when trying out remote caches, the CI venv will be "different" (existing at a different path), but the lockfile will be exactly the same. Ideally nothing would be invalidated.

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

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

はじめの一歩

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

調査の方向性

まず、mypy がキャッシュファイルと interface_hashes をどのように書き込み、比較しているかを追跡します。特に、仮想環境の完全なパスが記録される箇所を確認します。2 つの venv パスを使って無効化を再現し、キャッシュの挙動を比較します。異なるパスを持つ同等の環境では広範な無効化が発生せず、変更されたパッケージとその子孫は引き続き stale になることを確認できれば完了です。

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

評価

技術スタック
python
領域
devtools
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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