Python dependencies in Charm Libraries

Hello,

Naive question: has using Python packages for charm libraries been considered?

At the level of complexity that comes with adding dependencies to charm libraries, it seems like using Python packages instead of a single Python file might be simpler from the perspective of a charm developer.

With Python packages, dependency management could be compatible with tools in the Python ecosystem like pip-tools, Poetry, and Renovate. This would enable charm developers to use existing tooling, like what the Kubeflow team has implemented with pip-tools.


Also, maybe packages could help alleviate some of the limitations that have shown up from charm libraries being used beyond just the simple case of specifying relation interfaces for a single charm. Here are a few examples:

  • The data-platform-libs charm is not a charm that can be deployed, it only exists to host libraries
  • The mongodb charms use an internal charm library to share code between VM & Kubernetes charms. Python packages could enable much greater code sharing between the charm code for VMs and Kubernetes.
  • The mysql VM & Kubernetes charms both use the mysql library, but only the VM charm “owns” the library
1 Like