python / python/mypy

Treat relative paths in config file relative to config file, not cwd

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

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

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

説明

When using mypy_path = src it should be treated relative to the config file (if any), not the current working directory.
This also applies to the default of cache_dir (.cache_dir), which currently gets created in the current working directory always.

I.e. a detected/found (project) config file could be treated as the root for options with relative defaults also.

As for mypy_path this could be achieved in the type callback, which then however would need the config file / root as a new argument:
https://github.com/python/mypy/blob/84126ab9985844d8cda3809688034af895fdaf7c/mypy/config_parser.py#L75

As for global user config files, it should treat relative files therein relative to it, but it should not be used as a root for default settings like cache_dir.

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

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

はじめの一歩

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

調査の方向性

mypy/config_parser.py の 75 行目付近にある type callback から始め、検出されたプロジェクト設定のルートがオプション処理にどのように渡されるかを追跡します。相対 mypy_path 値と cache_dir のデフォルト値がプロジェクト設定ディレクトリを使用することを確認し、一方でグローバルユーザー設定ファイル内の相対パスは、そのファイルのディレクトリを使用しつつ、それをデフォルト設定のルートにはしないことを確認します。

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

評価

技術スタック
python
領域
tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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