How to pack your charm

See also:

You’ve initialised your charm and configured all the necessary files. This document shows you how you can now pack your charm. You can again do this with Charmcraft.

With a correct metadata.yaml and with ops in requirements.txt, packing your charm is as easy as running the following inside your charm directory:

$ charmcraft pack
Created 'my-new-charm.charm'.

In older docs you might find this given as charmcraft build. This is an alias maintained for backwards compatibility.

This will fetch any dependencies, compile any modules, check that all the key files are in place, and produce a compressed archive with the operator code and metadata as the charm.

The charm is just a zipfile with metadata and the operator code itself:

$ unzip -l my-new-charm.charm
Archive:  my-new-charm.charm
  Length      Date    Time    Name
---------  ---------- -----   ----
      221  2020-11-15 08:10   metadata.yaml
    25304  2020-11-15 08:14   venv/yaml/__pycache__/scanner.cpython-38.pyc
---------                     -------
   812617                     84 files

When the charm is packed, a series of analysis and lintings will happen, you may receive warnings and even errors to help improving the quality of the charm. To find out more, see Analyzers and linters.

Last updated 1 year, 26 days ago.