Skip to main content

A set of utilities around click, for extensible CLI

Project description

extencli

A set of utilities around click, which offers extensible CLI mechanism, with little effort

Features

Easy third-party extensible click.group

This package offers a specialized click.group implementation. Using it, you can create a CLI that will be extended by simply installing additional modules.

As an example, here is how one would define an extensible click.group in their python package core_module:

import click

from extencli import PluginAutoloaderGroup

@click.group('core', cls=PluginAutoloaderGroup, depends_on='core_module', load_attr='cli_extension')
def core_group():
    ...

The depends_on and load_attr parameters are required:

  • depends_on specifies the name of the package that CLI extensions should depend on
  • load_attr states the symbol that CLI extensions must provide as subcommands of the core_group

Please note that the load_attr attribute defines that the cli_extension symbol must be exposed as a top level attribute of any core_module extension module.

Now, the CLI extension package should import the core_group from the core_module like so:

from core_module.cli import core_group

@core_group.command('myext')
def cli_extension():
    ...

Now, by simply installing both the core_module and the extension third-party, the core_module will be extended with the myext command:

$> core --help
Usage: core [OPTIONS] COMMAND [ARGS]...

Options:
  --help                          Show this message and exit.

Commands:
  myext

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

extencli-0.1.2.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

extencli-0.1.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file extencli-0.1.2.tar.gz.

File metadata

  • Download URL: extencli-0.1.2.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for extencli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a4b73816b062e6676695f7186e74b277b5693c6ef77130fe02947fbe6c681c08
MD5 1216f69fe2b99d16101a3afa3f8c1409
BLAKE2b-256 f89fb956315b0960e3c51a9222279baa6a65a351c73ac363511167d289b419b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for extencli-0.1.2.tar.gz:

Publisher: workflow.yml on Joacchim/extencli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file extencli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: extencli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for extencli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 58910601520efb778f788cd22e6959c98255867967996d9a40b7c0982098ddd8
MD5 594bba3c89186cb3857f1b4ab47a667e
BLAKE2b-256 e5344e8b70da5e2bca82405c980e6a7b953b0e82ae38330b977a4c544583fc08

See more details on using hashes here.

Provenance

The following attestation bundles were made for extencli-0.1.2-py3-none-any.whl:

Publisher: workflow.yml on Joacchim/extencli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page