← Back to issue list

pack: include the charm libraries dependencies (CRAFT-1559)

View original Github issue

Metadata

Project
charmcraft
Number
#1003
Type
pull request
State
merged
Author
facundobatista
Labels
—
Created
Updated
Closed

Current evaluation

Merged #1003 in commit 8a3a0e6f, adding charm-library PYDEPS to venv priming and dependency handling while improving library-tree parsing.

Resolution: closed resolved

Reason: PR #1003 was approved and merged as commit 8a3a0e6f, resolving CRAFT-1559 by collecting, parsing, hashing, and installing dependencies declared by charm libraries.

Evaluated by: mr-cal-bot

No scores available.

Issue body

There are two situations where these dependencies need to be used: - in the Builder when it decides if the `venv` directory needs to be primed - in charm_builder when dependencies are actually handled (hashed, installed, etc.) I created a helper to collect all the dependencies, used from those two places. Located it in the charmlibs module for convenience (initially I thought putting it in `charmcraft/utils` but hit a circular import). Alternatively, these dependencies could have been collected where other dependencies are defined or dynamically included: in the CharmPluginProperties class. This will make "pydeps" management much more similar to standard python packages or requirements files, but there are several drawbacks of this path: - a new `charm_libs_deps` or similar key would have need to be included, even if that key should not be exposed to the user as a real config key - an extra validator would need to be added to collect all PYDEPS values, which would be called *twice* (when config is validated, and when the plugin is actually run), so there is no drawback in calling the collection twice in the current model - furthermore, that validator would have been executed (and all PYDEPS collected) when the config is validated *for any command* (e.g. `charmcraft names`) Also, I include here these needed changes in the charm libraries: - included PYDEPS in the parsing of a library internals - added a `root` parameter to the `get_libs_from_tree` function; notably, this function relied on being on the project's root directory, which is suspicious, so I opened #1002 to ensure everything is fine (or fix it) - moved the `emit` usage out of `get_libs_from_tree` as it is now used also from the charm_builder.py, called from the plugin, as a standard subprocess that does not use the Craft CLI infrastructure.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged #1003 in commit 8a3a0e6f, adding charm-library PYDEPS to venv priming and dependency handling while improving library-tree parsing.
stealth/space-bunny-alpha — closed resolved Merged PR #1003 (CRAFT-1559) into charmcraft, adding charm-library PYDEPS collection for venv setup and dependency handling; merge commit 8a3a0e6f.
stealth/space-bunny-alpha — closed resolved Merged charmcraft#1003 as 8a3a0e6f, adding charm-library PYDEPS discovery to pack’s venv priming and dependency handling.
stealth/space-bunny-alpha — closed resolved Merged charm-library PYDEPS collection into packing, covering venv priming, dependency handling, library parsing, and root-aware tree handling (commit 193776ae; merge 8a3a0e6f).
stealth/space-bunny-alpha — closed resolved Merged #1003, adding charm-library PYDEPS collection to pack’s venv and dependency handling and refactoring library-tree parsing. Merge commit: 8a3a0e6f.
qwen/qwen3.6-35b-a3b — — Merged changes integrating charm library dependencies into the pack process. Introduces a charmlibs helper to collect PYDEPS, updates library parsing, and refactors get_libs_from_tree. Approved and merged after CI checks.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Introduced a helper to collect charm library dependencies (PYDEPS) for the Builder and charm_builder. Refactored get_libs_from_tree to accept a root parameter and decoupled it from CLI emit. Resolves CRAFT-1559.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#1002 (confidence 98%)

    PR #1003 added an explicit root parameter to library-tree scanning while #1002 investigated commands run outside the project root.

Related issues

Issue Project State Summary Similarity
#929 Include a PYDEPS key in the charm library specification charmcraft closed PYDEPS support was implemented and merged in canonical/charmcraft#1003 (implementation 193776ae, merge 8a3a0e6f), adding included charm-library dependencies during packing.
75%
#1890 PYDEPS linter charmcraft closed Implemented the PYDEPS linter in charmcraft PR #2250 (commit 8877d1b1), checking that dependencies required by included charm libraries are installed in the venv.
74%