Entry Points

gallia uses the entry_points mechanism for registering plugins. These entry points are known by gallia:


List of subclasses of gallia.command.BaseCommand add new a command to the CLI.


List of callables which get called during the initialization phase of the ArgumentParser; can be used to add new groups to the CLI.


List of subclasses of gallia.transports.BaseTransport add a new URI scheme for the --target flag.


List of subclasses of which add new choices for the --oem flag.


Below is an example that adds a new command to the CLI (using gallia.command.Script). Let’s assume the following code snippet lives in the python module within the hello_gallia package.

from argparse import Namespace

from gallia.command import Script

class HelloWorld(Script):
    """A hello world script showing gallia's plugin API."""

    COMMAND = "hello"
    SHORT_HELP = "say hello to the world"

    def main(self, args: Namespace) -> None:
        print("Hello World")

commands = [HelloWorld]

In pyproject.toml using poetry the following entry_point needs to be specified:

"hello_world_commands" = "hello_gallia.hello:commands"

After issueing poetry install, the script can be called with gallia script hello.

If a standalone script is desired, the HelloWorld class can be called like this:

parser = argparse.ArgumentParser()