python / python/cpython

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

Abierto
#122,099 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

topic-venv type-feature
Lenguaje dominante
Python
Estrellas
77.2k
Forks
36k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el caso usando un test-env con pyvenv.cfg indicando Python 3.9.9, mientras que test-env/bin/python se resuelve en Python 3.12.4. Rastrea el inicio del entorno virtual desde test-env/bin/python e inspecciona cómo se lee pyvenv.cfg; el trabajo estará terminado cuando aparezca una advertencia si su versión minor difiere de la del intérprete en ejecución.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
tooling
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.