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 customized click.group definition, allowing one to quickly define a group of commands, which can be extended by any package using the group defined thus. From thereon, simply installing one's core module, and the third-party extension would automatically extend the core's CLI with the third-party.

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

from extencli import PluginAutoloaderGroup

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

The base_module and attribute_name parameter are required to ensure that:

  • automated loading of the third-party packages will be done based on the dependency to core_module
  • third-party packages will be expected to provide a cli_extension function as their extension's entrypoint

Thus, a third party would merely need to do the following, in order for it to be automatically loaded by the core_module auto-extension mechanism:

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, one would be able to observe that the core_module's CLI was 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.1.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.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: extencli-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 5a9b8bb389bc805410e1280065fe52373aa3a41f95d6a6acc2cbcd5175d3eaa0
MD5 3c18d9e6bf47fc3498c60cba55d46f3a
BLAKE2b-256 dc8c157da32f486c02a693d1d03149a5d1ebadd07a55461c3afae9f9bbebcb8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for extencli-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: extencli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 db7eede5cc0cb10071d18cdc4bf693100be69e32d269c52d4f407fbb7fc48eae
MD5 4e43ca8a09458d654d46de286ec3a157
BLAKE2b-256 fcdf6e334e5216f689e4ec6822bdc784bb9c2aa3636daff53fd3a8231c4992de

See more details on using hashes here.

Provenance

The following attestation bundles were made for extencli-0.1.1-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