Warn or error if a virtual environment was included in the app source
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- build-system
Direzione di ricerca
Non è indicato alcun file sorgente né alcun test. Inizia tracciando il percorso di build utilizzato da pack build e dal deployment basato su Git, quindi esamina come il buildpack segnala contenuti sorgente non validi o non necessari. Il lavoro è completato quando una directory .venv/ o venv/ produce in modo affidabile l'avviso o l'errore scelto, con la copertura del flusso di build interessato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
When using Python virtual environments, it's common to store the virtual environment (aka venv / virtualenv) inside the project directory, inside a directory named .venv/ or venv/. (At least when creating them manually, or using 'uv' which prefers storing them inside the project. Poetry/Pipenv prefer a global venv location outside of the project.)
This directory should always be added to the .gitignore, but sometimes users forget, meaning it is committed to the Git repo, and will be included in the app source when using a Git based deployment mechanism (such as git push heroku main).
In addition, even if users add the .venv/ to their .gitignore, it will still be included in the app source when building locally using pack build, unless they know to also exclude the directory via the project.toml exclude field:
https://github.com/buildpacks/spec/blob/main/extensions/project-descriptor.md#iobuildpacksinclude-optional-and-iobuildpacksexclude-optional
(Even if they have added the .venv to their .dockerignore that won't help, since Pack CLI doesn't use that file - at least not yet; perhaps we should suggest this upstream?)
We should warn or even error if a .venv/ or venv/ directory is present during the build, since:
- virtual environments are always machine-specific (os/arch specific, plus typically path specific and not relocatable) so a local venv won't work in the app image anyway
- the buildpack installs deps into its own venv in a layer, so even if the local venv did work, it would be redundant anyway
- including a local venv bloats the final app image size (and git repo, if committed)
- having two venvs in the image will cause confusion when users are debugging, since they might think the one inside the app source directory is what is being used (when it won't be)
GUS-W-19127270.
- Lingua principale
- Rust
- Stelle
- 33
- Fork
- 3
- Merge medio
- 15h 49m
- PR unite (30g)
- 7
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di heroku/buildpacks-python
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
heroku/buildpacks-python#452 · 3 commenti ·
-
Support Dev DependenciesApertaclassic buildpack parity enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
heroku/buildpacks-python#372 · 10 commenti · 3 reazioni ·
-
classic buildpack parity
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
heroku/buildpacks-python#288 ·
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
heroku/buildpacks-python#268 ·
-
classic buildpack parity semver: major
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
heroku/buildpacks-python#267 ·
Tutte le issue di heroku/buildpacks-python
Issue simili
-
area: dogs area: lookout bug security
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
I maintainer di solito rispondono entro 2 giorni
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
OpenDevicePartnership/ina4230#31 ·
I maintainer di solito rispondono entro 1 giorno
-
area:breg criticality:p3 documentation triage:needs-implementation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
registrystack/registry-stack#1713 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
posit-dev/ggsql#565 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno