python / python/cpython

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

Aberta
#122,099 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

topic-venv type-feature
Linguagem predominante
Python
Estrelas
77.2k
Forks
36k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Reproduza o caso usando um test-env com pyvenv.cfg informando Python 3.9.9, enquanto test-env/bin/python resolve para Python 3.12.4. Rastreie a inicialização do ambiente virtual a partir de test-env/bin/python e inspecione como pyvenv.cfg é lido; o trabalho estará concluído quando um aviso aparecer se a versão minor dele diferir da do interpretador em execução.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
tooling
Tipo de issue
Funcionalidade
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
48/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.