canonical / canonical/layer-basic
use_venv breaks charmhelpers.contrib.python.pip_install
- Lingua principale
- Python
- Stelle
- 10
- Fork
- 42
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Per the layer-basic docs, `wheelhouse.txt` is intended only for **charm** dependencies. Payload dependencies should be installed separately.
For installing Python packages, this has traditionally been accomplished via `charmhelpers.contrib.python.pip_install`. The default use of venv has created a side-effect that breaks this pattern.
Internally, [pip_install](https://github.com/juju/charm-helpers/blob/master/charmhelpers/contrib/python/packages.py#L29) import's pip and execute's it's main:
```python
def pip_execute(*args, **kwargs):
[...]
try:
_path = sys.path
try:
from pip import main as _pip_execute
except ImportError:
apt_update()
if six.PY2:
apt_install('python-pip')
else:
apt_install('python3-pip')
from pip import main as _pip_execute
_pip_execute(*args, **kwargs)
finally:
sys.path = _path
```
This will use the pip installed inside the venv, installing the package(s) there rather than to the system and the payload will fail due to missing dependencies.
I'm not sure if we want to patch charmhelpers.contrib.python, if it's feasible to do something within layer:basic, or if we should instead create a new layer in the spirit of layer:apt to install packages in a way that's fully compatible with a charm-centric venv.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia dalla documentazione di layer-basic relativa a `wheelhouse.txt` e esamina `charmhelpers.contrib.python.packages.py`, in particolare `pip_execute`. Confronta il modo in cui `use_venv` modifica la risoluzione di pip e i percorsi di installazione, quindi stabilisci quale layer o helper dovrebbe occuparsi dell'installazione delle dipendenze del payload. Il lavoro è completato quando il modello documentato per l'installazione del payload funziona senza che le dipendenze siano nascoste all'interno del venv del charm.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100