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')
def core_group():
...
The depends_on parameter is required:
depends_onspecifies the name of the package that CLI extensions should depend on
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
Caveats
Silent "failure" to load extensions
If the base CLI has its extensible group declared in the __init__.py file,
the internal click initialization mechanism might use different instances of
the group when loaded by extensions, and when invoked through the CLI.
To avoid this, please refer to the tests's tests/python_packages/test_core
python module, which is built in a way that avoid this caveat:
- extensible group should not be in the
__init__.pyfile pyproject.tomlmay refer directly to it for script entrypoints
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file extencli-0.3.0.tar.gz.
File metadata
- Download URL: extencli-0.3.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddbb32d139ef912133527333f31d618deb5dba4ee1f36076d8f00fcce5a00101
|
|
| MD5 |
f9352283612e4eb77343fd309bf110ff
|
|
| BLAKE2b-256 |
24c4ec747be05aedf4ea619dcd0739111f798f8f9e7896dcb4d6c54a26d7b023
|
Provenance
The following attestation bundles were made for extencli-0.3.0.tar.gz:
Publisher:
workflow.yml on Joacchim/extencli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
extencli-0.3.0.tar.gz -
Subject digest:
ddbb32d139ef912133527333f31d618deb5dba4ee1f36076d8f00fcce5a00101 - Sigstore transparency entry: 1873479916
- Sigstore integration time:
-
Permalink:
Joacchim/extencli@24b8ce393411f93d1dc7cc1a575d10404fb49025 -
Branch / Tag:
refs/tags/0.3.0 - Owner: https://github.com/Joacchim
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@24b8ce393411f93d1dc7cc1a575d10404fb49025 -
Trigger Event:
push
-
Statement type:
File details
Details for the file extencli-0.3.0-py3-none-any.whl.
File metadata
- Download URL: extencli-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d35bb03deb4d223084566d0bd8cf99162db45c84b1d661d4e481eafd5ee11a0
|
|
| MD5 |
b932fd1790b1e3d524b811829a62139f
|
|
| BLAKE2b-256 |
f6b464a49e703d12f5e6c0bd6a6f55ab05ed6dd0f4ac3920a18ea9a55e56f675
|
Provenance
The following attestation bundles were made for extencli-0.3.0-py3-none-any.whl:
Publisher:
workflow.yml on Joacchim/extencli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
extencli-0.3.0-py3-none-any.whl -
Subject digest:
3d35bb03deb4d223084566d0bd8cf99162db45c84b1d661d4e481eafd5ee11a0 - Sigstore transparency entry: 1873479982
- Sigstore integration time:
-
Permalink:
Joacchim/extencli@24b8ce393411f93d1dc7cc1a575d10404fb49025 -
Branch / Tag:
refs/tags/0.3.0 - Owner: https://github.com/Joacchim
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@24b8ce393411f93d1dc7cc1a575d10404fb49025 -
Trigger Event:
push
-
Statement type: