python / python/cpython

Unify interpretation of values of environment variables and CLI options

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

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

type-feature
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

There is inconsistency in interpreting values of different environment variables that have equivalent of CLI options.

  • For some environment variables, defining them with any values (even empty) is interpreted as true.
  • For some environment variables, any values except 0 (including non-numbers and empty value) are interpreted as true. Only 0 is interpreted as false. For some of these variables it makes sense to set integer value > 1, but for other they are just booleans.
  • PYTHONUTF8 and PYTHON_GIL only accept "1" and "0". All other values are errors. Although the code for these two variables is very different.
  • PYTHON_FROZEN_MODULES only accepts "on" and "off". All other values are errors.
  • PYTHONCOERCECLOCALE has three state: "0", "warn" and... anything other.
  • Some environment variables has "0" as a special value, but PYTHON_CPU_COUNT uses "default".

There are similar things for corresponding CLI options which accept optional arguments.

Such diversity makes it difficult to document and use environment variables and CLI options. It can lead to subtle bugs if "0" is interpreted differently. An empty value of the environment variable can be the result of a hidden bug, but in most cases it is currently silently accepted and interpreted as true value.

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

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

はじめの一歩

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

調査の方向性

まず、issue に記載されている環境変数と同等の CLI オプションを洗い出し、空の値、数値、ブール値、無効な値に対する現在の処理を比較します。実装の前に、解釈ポリシーについて合意する必要があります。列挙された環境変数と対応する CLI オプションが、無効な値の一貫した処理を含め、一貫したルールに従えば完了です。

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

評価

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

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

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