venv: optional activate link/copy to solve ci/portability headaches
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 36k
- Ø Merge
- 1 T. 9 Std.
- Gemergte PRs (30 T.)
- 558
Beschreibung
Problem
activate location is platform dependent.
Background
15+ years ago PyPY made a decision that has often been a headache for portability; putting activate in Scripts for Windows and bin for everyone else.
This is sometimes misreported as a bug (https://github.com/python/cpython/issues/97586), core issue (https://bugs.python.org/issue35003), discussion (https://github.com/python/cpython/pull/18083) and recurrent threads on the pypy issues list (https://github.com/pypa/virtualenv/issues/2404, https://github.com/pypa/virtualenv/issues/1418#issuecomment-910044412)
It's an exceptional pain point because 1/ you chose python to ease portability, -2->/ you use venv as an extra layer of abstraction, -3->/ surprise! your abstraction requires you to take two different routes based on platform!
Proposal
Introduce an option that causes the creation of a symlink or second copy of the activator at a user specified path.
Ubuntu|Pwsh> venv -p python 3.10 --activator-copy=/opt/ci/activate /opt/ci
Windows|Pwsh> venv -p python 3.10 --activator-copy=o:/ci/activate o:/ci
Arguments
(Per the original change) "Scripts is the correct location for activate on Windows"
- This doesn't move it, so everything that already supports the split will work as before,
- Python itself now violates the Scripts rule, which is an attractor to people who wanted to hide platform specifics,
It's not a big deal, just if .. then else
CI and building today is complex with many moving parts, having an intermediate level abstraction suddenly require you to think about platforms is always a headache. If you're using something like gitlab, you end up with a huge hitch in complexity to achieve this for the scope it's in under the current system.
Windows doesn't support symlinks
Whether it is a file or a symlink is irrelevant, and anyone who is actively working to support a version of Windows old enough to not support symlinks already has enough of their hair on fire that they'll gladly accept it falling back to creating a file instead of junction.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Es werden keine Dateien oder Tests genannt. Verfolge die Erstellung von venv und die Verarbeitung seiner Befehlszeilenoptionen und überprüfe anschließend den vorgeschlagenen, vom Benutzer angegebenen Aktivatorpfad unter Ubuntu und Windows PowerShell, einschließlich des Symlink-oder-Kopie-Verhaltens; als erledigt gilt, dass die Option funktioniert, ohne bestehende plattformspezifische Speicherorte zu ändern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- cli, devtools
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100