`charmcraft init`

Usage:

charmcraft init [options]

Summary:

Initialize a charm operator package tree and files.

This command will modify the directory to create the necessary files for a charm operator package. By default it will work in the current directory. It will setup the following tree of files and directories:

.
├── metadata.yaml        - Charm operator package description
├── README.md            - Frontpage for your charmhub.io/charm/
├── CONTRIBUTING.md      - Instructions for how to build and develop your charm
├── actions.yaml         - Day-2 action declarations, e.g. backup, restore
├── charmcraft.yaml      - Charm build configuration
├── config.yaml          - Config schema for your operator
├── LICENSE              - Your charm license, we recommend Apache 2
├── requirements.txt     - PyPI dependencies for your charm, with `ops`
├── requirements-dev.txt - PyPI for development tooling, notably flake8
├── run_tests
├── src
│   └── charm.py         - Minimal operator using Python operator framework
└── tests
    ├── __init__.py
    └── test_charm.py

You will need to edit at least metadata.yaml and README.md.

Your minimal operator code is in src/charm.py which uses the Python operator framework from https://github.com/canonical/operator and there are some example tests with a harness to run them.

Options:

-h, --help Show this help message and exit
-v, --verbose Show debug information and be more verbose
-q, --quiet Only show warnings and errors, not progress
--verbosity Set the verbosity level to ‘quiet’, ‘brief’, ‘verbose’, ‘debug’ or ‘trace’
-p, --project-dir Specify the project’s directory (defaults to current)
--name The name of the charm; defaults to the directory name
--author The charm author; defaults to the current user name per GECOS
-f, --force Initialize even if the directory is not empty (will not overwrite files)

See also:

  • analyze
  • clean
  • pack
  • version

Last updated a month ago.