juju / charm-tools

Tools for charm authors and maintainers
Other
42 stars 64 forks source link

Add option to upgrade core deps in build venv #650

Closed fnordahl closed 1 year ago

fnordahl commented 1 year ago

Some packages may require newer versions of core dependencies for successful execution of the pip download or pip wheel commands. Most notable example is Jinja2 and MarkupSafe when installed on Focal ref pallets/jinja#1496.

At this stage of the process the input from the charm wheelhouse.txt is not sufficient.

Add an option to upgrade pip and setuptools in the build venv to deal with these situations.

Fixes: #646 Signed-off-by: Frode Nordahl frode.nordahl@canonical.com

lathiat commented 1 year ago

Does this fix the same issue, but with a charmcraft.yaml change rather than a config option? https://discourse.charmhub.io/t/install-or-update-python-packages-before-packing-a-charm/5158

Not clear to me if the proposed fix here works in some cases the above wouldn't. But the above fix went in only a couple weeks before this bug/fix so not sure if it was just missed.

(Originally from: https://github.com/canonical/charmcraft/issues/551)

fnordahl commented 1 year ago

Does this fix the same issue, but with a charmcraft.yaml change rather than a config option? https://discourse.charmhub.io/t/install-or-update-python-packages-before-packing-a-charm/5158

Not clear to me if the proposed fix here works in some cases the above wouldn't. But the above fix went in only a couple weeks before this bug/fix so not sure if it was just missed.

(Originally from: canonical/charmcraft#551)

The charmcraft fix is only usable by the charm plugin for operator framework charms. When building with the reactive plugin charm-tools is in charge of the virtualenv.

Once this PR is merged, you would be able to control this through the charmcraft.yaml like this:

type: charm

parts:
  charm:
    source: src/
    plugin: reactive
    reactive-charm-build-arguments:
      - --binary-wheels-from-source
      - -v
      - --upgrade-buildvenv-core-deps