Skip to main content

module-cli

Bootstrap extensible single-module python CLIs

PyPI Version codecov Tests Code Style Type Check

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] [-D] [out]

Bootstrap a single-module python CLI

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
  -D, --debug    run program in debug mode

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

  1. Have or install a recent version of poetry (version >= 1.1)
  2. Fork the repo
  3. Setup a virtual environment (however you prefer)
  4. Run poetry install
  5. Run pre-commit install
  6. Add your changes (adding/updating tests is always nice too)
  7. Commit your changes + push to your fork
  8. Open a PR

Download files

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

Source Distribution

module-cli-22.4.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

module_cli-22.4.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file module-cli-22.4.2.tar.gz.

File metadata

  • Download URL: module-cli-22.4.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.4 Linux/5.13.0-1021-azure

File hashes

Hashes for module-cli-22.4.2.tar.gz
Algorithm Hash digest
SHA256 fc4cee5372867ddd194e8f1760e21e71eacf61fcb6d5248f31c19911b90cce1a
MD5 38239a5bcec0c1ad10e56ca91c967af6
BLAKE2b-256 532b670c3685410cc0d9c5367c9c5d35e2d6104a506a79408780155e0a7f447f

See more details on using hashes here.

File details

Details for the file module_cli-22.4.2-py3-none-any.whl.

File metadata

  • Download URL: module_cli-22.4.2-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.4 Linux/5.13.0-1021-azure

File hashes

Hashes for module_cli-22.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6d2c71f24b47a2291cfcd6174b0811b325e789083c31b0c8a2a7ddd734c83600
MD5 01d3057a9e0acd30a7cb47e5e23cc191
BLAKE2b-256 c2c4d1e39cc4e12359f08b4f1b82ba543359fab75ed088add5de36e316d3375f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

22.4.2 This release

2 files

22.4.1

2 files

22.4.0

2 files

1.0.0

2 files

0.1.0

2 files

Supported by

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