Closed fnordahl closed 1 year ago
+1 to this issue.
When charmcraft
packs a charm using the charm
plugin, it builds a virtualenv and then allows the user to install packages there before actually dealing the charm requirements. This way, the user can upgrade setuptools
and pip
, a step that is needed for later proper installation of Jinja2 (the Focal default versions of setuptools
and pip
do not handle that correctly).
But in the case of charmcraft
packing a charm using the reactive
plugin, it will end up calling the charm
tool, which is the one responsible of the virtualenv creation and installation of charm requirements. As everything is handled in the same charm
process, there is no way charmcraft
can get in the middle and update these packages "from outside".
So it would be awesome if the charm
tool handles this. Thank you!!
Does this change fix this: https://discourse.charmhub.io/t/install-or-update-python-packages-before-packing-a-charm/5158
See also: https://github.com/canonical/charmcraft/issues/551
Does this change fix this: https://discourse.charmhub.io/t/install-or-update-python-packages-before-packing-a-charm/5158
See also: canonical/charmcraft#551
No, when building with the reactive plugin, charm-tools is in charge of the virtualenv, the fix in charmcraft only affects building with the charm plugin for operator framework charms. See also https://github.com/juju/charm-tools/issues/646#issuecomment-1273451182
Some python packages may require changes to the virtualenv used to build wheels. There is currently no way of doing that.
One example is Jinja2 when building on Focal (ref pallets/jinja#1496): https://github.com/juju/charm-tools/blob/977ec1ff795f5a8692f8061fc16aa01adf9478cf/.github/workflows/tests.yml#L57-L66
The virtualenv is created by charm-tools here: https://github.com/juju/charm-tools/blob/977ec1ff795f5a8692f8061fc16aa01adf9478cf/charmtools/build/tactics.py#L1241-L1244