Unify interpretation of values of environment variables and CLI options
未關閉
還沒有人認領這個 Issue。
type-feature
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- 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.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先,盤點 issue 中描述的環境變數及其對應的 CLI 選項,比較它們目前對空值、數值、布林值和無效值的處理方式。實作之前需要先就解釋策略達成共識。完成的標準是:列出的環境變數及其對應的 CLI 選項遵循一致的規則,包括對無效值的一致處理。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- cli
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100