Bootstrap extensible single-module CLIs
Project description
module-cli
Bootstrap extensible single-module CLIs
Installation
With pipx
This package is intended to generate python modules that function as CLIs and therefore shouldn't be a dependency of any module/package that it generates. Because of this it's recommended to use this package via pipx
:
pipx run module-cli /path/to/module.py
With pip
If you really want this package as one of your package's dependencies, then install via pip
in the usual way:
pip install module-cli
Which you can then use the CLI:
$ module-cli -h
usage: module-cli [-h] [-v] [out]
positional arguments:
out File to write to. (default: -)
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
Installing your CLI
The modules generated by module-cli
contain a function cli()
. This function is the one you'll likely want to point to if you intend to turn your module into an installable command-line application.
-
setup.cfg
:[options.entry_points] console_scripts = my_cli = my_pkg.my_module:cli
-
setup.py
:setup( entry_points = { 'console_scripts': ['my_cli=my_pkg.my_module:cli'], } )
-
pyproject.toml
(poetry):[tool.poetry.scripts] my_cli = "my_pkg.my_module:cli"
Contributing
- Have or install a recent version of
poetry
(version >= 1.1) - Fork the repo
- Setup a virtual environment (however you prefer)
- Run
poetry install
- Run
pre-commit install
- Add your changes (adding/updating tests is always nice too)
- Commit your changes + push to your fork
- Open a PR
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
Hashes for module_cli-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6dd8ff1f7f7cf2edaaa051248532d2dd44c05c2613fe992f328c2b88965cb428 |
|
MD5 | 1cc7cbc4a8c2d8cd70fc493941251cf5 |
|
BLAKE2b-256 | 362fd94f14da1b449046c1ec2c867096b50ca3e23ce963ab8b7ef2db28cbe502 |