Issue warning when running an outdated virtual environment after updating Python in-place
未關閉
還沒有人認領這個 Issue。
topic-venv
type-feature
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Feature or enhancement
Proposal:
Here's a virtual environment created with an older Python version (3.9, in this case):
$ cat test-env/pyvenv.cfg
home = /usr/bin
include-system-site-packages = false
version = 3.9.9
$ ls -n test-env/bin/
total 36
-rw-r--r-- 1 1000 985 1912 Jul 21 21:48 activate
-rw-r--r-- 1 1000 985 861 Jul 21 21:48 activate.csh
-rw-r--r-- 1 1000 985 2001 Jul 21 21:48 activate.fish
-rw-r--r-- 1 1000 985 8834 Jul 21 21:48 Activate.ps1
-rwxr-xr-x 1 1000 985 252 Jul 21 21:48 pip*
-rwxr-xr-x 1 1000 985 252 Jul 21 21:48 pip3*
-rwxr-xr-x 1 1000 985 252 Jul 21 21:48 pip3.9*
lrwxrwxrwx 1 1000 985 15 Jul 21 21:49 python -> /usr/bin/python*
lrwxrwxrwx 1 1000 985 6 Jul 21 21:50 python3 -> python*
lrwxrwxrwx 1 1000 985 6 Jul 21 21:51 python3.9 -> python*
After updating /usr/bin/python in-place (to 3.12.4, in this case), the environment runs without warnings.
$ test-env/bin/python
Python 3.12.4 (main, Jun 7 2024, 06:33:07) [GCC 14.1.1 20240522] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
The proposal here would be to, at least, issue a warning when the minor version of the version key in pyvenv.cfg is different from the running interpreter.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
使用一個 pyvenv.cfg 回報 Python 3.9.9、而 test-env/bin/python 解析為 Python 3.12.4 的 test-env 重現此案例。從 test-env/bin/python 追蹤虛擬環境的啟動,並檢查 pyvenv.cfg 的讀取方式;當其 minor 版本與正在執行的直譯器的 minor 版本不同時出現警告,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- tooling
- Issue 類型
- 功能
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100