venv.EnvBuilder creates inconsistent venv depending on the name of the Python executable
オープン
まだ誰も着手していません。
stdlib
topic-venv
type-bug
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
Given the below create-venv.py script and several Python 3 installed in the classpath:
import sys
import venv
if __name__ == "__main__":
venv.EnvBuilder().create(sys.argv[1])
Let’s create various venvs:
for VERSION in 3.9 3.11 3.12; do
python$VERSION create-venv.py $VERSION-venv
for EXEC in python python3 python$VERSION; do
$VERSION-venv/bin/$EXEC create-venv.py $VERSION-$EXEC-venv
done
done
And now, let’s check them:
for PYTHON in *-venv/bin/python; do
echo "$PYTHON: $($PYTHON --version)"
done
The above loop outputs:
3.11-python3.11-venv/bin/python: Python 3.11.7
3.11-python3-venv/bin/python: Python 3.9.14
3.11-python-venv/bin/python: Python 3.9.14
3.11-venv/bin/python: Python 3.11.7
3.12-python3.12-venv/bin/python: Python 3.12.1
3.12-python3-venv/bin/python: Python 3.9.14
3.12-python-venv/bin/python: Python 3.9.14
3.12-venv/bin/python: Python 3.12.1
3.9-python3.9-venv/bin/python: Python 3.9.14
3.9-python3-venv/bin/python: Python 3.9.14
3.9-python-venv/bin/python: Python 3.9.14
3.9-venv/bin/python: Python 3.9.14
As the reader can see, Python venv’s created by python or python3 executable of a Python venv will not use the Python of this venv, and instead will use the system’s default Python (3.9 in my case).
CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Oracle Linux 9 and 10
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された create-venv.py スクリプトと venv.EnvBuilder エントリポイントから始め、複数の Python 実行可能ファイル名を使ってシェルループを実行し、インタープリターの選択に一貫性がない状態を再現します。EnvBuilder の呼び出しに使用された実行可能ファイルがどのように記録され、各環境の作成時にどのように使用されるかを追跡します。python、python3、そして venv 内のバージョン付き実行可能ファイルが、その venv のインタープリターを使用して一貫して環境を作成できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100