Documentation of sys.base_prefix is unclear when a virtual environment is created from another virtual environment

Aperta
#95,469 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Inizia con la documentazione di sys.base_prefix e sys.base_exec_prefix, quindi esamina il comportamento descritto per la creazione di venv annidati usando i comandi mostrati. Leggi site.py e verifica l’effetto dell’opzione -S di Python. Il lavoro è completato quando la documentazione indica esplicitamente i valori previsti per gli ambienti virtuali annidati e documenta il comportamento di -S.

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

Descrizione

docs

Documentation of the sys module

The documentation of sys.base_prefix states that "base_prefix and base_exec_prefix will remain pointing to the base Python installation (the one which the virtual environment was created from)"

In the case of creating one virtual environment from another:

python -m venv foo --without pip
foo/Scripts/python.exe -m venv bar --without-pip

sys.base_prefix in bar points to the system Python installation, not to foo. (Tested on Windows). I believe this behaviour is better, and I'm suspect that existing tools rely on it, but regardless of what is correct behaviour, the documentation should be more explicit about what the expected value of sys.base_prefix is in a virtual environment created from another virtual environment.

Also, given that the behaviour is documented as being (at least in part) implemented in site.py, the behaviour when the -S flag ("don't import site") is supplied to Python should be documented as well.

Lingua principale
Python
Stelle
77.2k
Fork
36k
Merge medio
1g 9h
PR unite (30g)
558

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.

Altre issue di python/cpython

Tutte le issue di python/cpython

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.