The location of a charm library inside a charm

Charm libraries are located in a directory inside the charm with the following structure:


where $CHARMDIR is the project’s root (contains src/, hooks/, etc.), and the <charm> placeholder represents the charm responsible for the library named as <libname>.py with API version <API>.

For example, inside a charm mysql, the library db with major version 3 will be in a directory with the structure below:


This location also gives the python import path for the charm. For example, importing the library above in Python would look like:

import charms.mysql.v3.db

Last updated 6 months ago.