Charmcraft and parts: using git requirements

Starting in version 1.2.0, Charmcraft includes parts processing. It means that additional entries under the parts section in charmcraft.yaml are now allowed, as well as common part keywords similar to those used in Snapcraft. Parts support will be improved in forthcoming versions to offer a more complete experience.

Among the new charm part entries is build-packages. It allows the charm developer to specify packages that must be installed on the system before building the part. Common build-packages entries are libraries or tools required by the part build process.

Sometimes a charm developer needs to use the git version of a dependency listed in requirements.txt, and pip may complain that git is not installed. In this case, add it to the list of build packages:

parts:
  charm:
    build-packages: [git]
    prime:
      - ...

This should address the issue with git or any other VCS tool supported by pip. We are aware that the pip error message is very verbose and it’s not trivial to spot the actual error. This should also be addressed in the future to provide a better output.

3 Likes