Code Monkey home page Code Monkey logo

module-cli's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.