python / python/typeshed

Adding platform information to stdlib/VERSIONS

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

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

project: policy
主要言語
Python
スター
5.1k
フォーク
2.1k
平均マージ
1日 19時間
マージ済み PR(30日)
82

説明

It might be a good idea to add platform availability information to stdlib/VERSIONS, instead of using the sys.platform hack we're currently using in the source files. This has the same rationale for introducing VERSIONS in the first place:

  • Remove platform checks and the required indentation from stub files.
  • Enables clearer type checker messages (e.g. "Module does not exist on this platform", instead of "Item X doesn't exist in module Y")
  • Generally an unambiguous way of indicating that a module doesn't exist.
  • Edit: Collect all information about module availability in one place.

One way to do this is an HTTP/E-Mail header-like key/value syntax:

abc: 3.0-; platforms=linux,darwin
def: 3.7-3.10; platforms=!windows,!linux
ghi: 3.9-

This would allow future extension when type checkers are equipped to ignore unknown keys:

abc: 3.0-; header1=foo; header2=bar

Do we need a way do indicate that a certain platform only supports a certain module starting from a certain Linux version?

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

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

はじめの一歩

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

調査の方向性

stdlib/VERSIONS と、現在 sys.platform のチェックを使用しているソースファイルから始めます。そこでモジュールの利用可能性がどのように表現されているか、また型チェッカーがそれをどのように利用するかを確認します。バージョン固有のプラットフォームサポートと未知のキーの扱いを含め、プラットフォームのキーと値の形式を定義します。提案が実装に十分なレベルで仕様化されていれば完了です。

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

評価

技術スタック
python
領域
tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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