Skip to content

Bootstrap your Python based CLI applications within minutes! 🚀

License

Notifications You must be signed in to change notification settings

yankeexe/cookiecutter-python-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cookiecutter for Python Click CLI 🍪

Comes with:

  • Pre-commit hooks
  • mypy
  • flake8
  • mkdocs-material
  • packaging
  • Containerization

Usage

Install cookiecutter.

$ pip install --user cookiecutter

Generate your project template using cookiecutter.

$ cookiecutter gh:yankeexe/cookiecutter-python-cli

Project Setup

  1. cd into project directory.

  2. Create a virtual environment.

$ make venv
  1. Activate it.
$ source venv/bin/activate
  1. Install development dependencies with editable mode to test the CLI.
$ make install

Take your CLI for a spin

This Cookiecutter comes with two generic CLI commands, namely, init and show.

NOTE

<<cli_command>> is the executable command you choose for your CLI during project setup.

$ <<cli_command>> init
$ <<cli_command>> show

Test with Docker

CLI commands can be tested with Docker.

  1. Build an image for the CLI.

    Image is tagged with the same name as the cli_command.

$ make docker-image
  1. Run the command inside the container.
$ docker-run --rm <<cli_command>> init

Documentation

  1. Install documentation-related dependencies.
$ make docs
  1. Serve the docs locally.
$ make serve-docs

Distribution

NOTE

Make sure you have account in PyPI before you try this out.

To publish you CLI to PyPI, run:

$ make distributions

dist directory will be created inside your project directory. Upload it to PyPI using:

$ twine dist/*

Help

For help related to make commands.

$ make help