Subcommands

The conda CLI can be extended with the conda_subcommands plugin hook. Registered subcommands will be available under the conda <subcommand> command.

class CondaSubcommand(name: str, summary: str, action: Callable[[list[str]], int | None])

A conda subcommand.

Parameters
  • name -- Subcommand name (e.g., conda my-subcommand-name).

  • summary -- Subcommand summary, will be shown in conda --help.

  • action -- Callable that will be run when the subcommand is invoked.

action: Callable[[list[str]], int | None]

Alias for field number 2

name: str

Alias for field number 0

summary: str

Alias for field number 1

conda_subcommands(self) collections.abc.Iterable[conda.plugins.types.CondaSubcommand]

Register external subcommands in conda.

Returns

An iterable of subcommand entries.

Example:

from conda import plugins


def example_command(args):
    print("This is an example command!")


@plugins.hookimpl
def conda_subcommands():
    yield plugins.CondaSubcommand(
        name="example",
        summary="example command",
        action=example_command,
    )