python / python/cpython

Issue warning when running an outdated virtual environment after updating Python in-place

Aperta
#122,099 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

topic-venv type-feature
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci il caso usando un test-env con pyvenv.cfg che indica Python 3.9.9, mentre test-env/bin/python viene risolto in Python 3.12.4. Traccia l’avvio dell’ambiente virtuale da test-env/bin/python e verifica come viene letto pyvenv.cfg; il lavoro è completato quando compare un avviso se la sua versione minor differisce da quella dell’interprete in esecuzione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.