1. Introduction¶
This chapter introduces cookiecutter-cliffapp-template
for creating a
feature-filled Git repository for a Python command line interface (CLI) that
you can use to develop, test, and publish as a package on the Python
Package Index.
1.1. Features¶
Uses the
cookiecutter-cliffapp-template
to produce a bare-bones functional Python CLI app built on the OpenStack cliff – Command Line Interface Formulation Framework.cliff
provides many useful features like modularizing subcommands into groups, built-in help for internally documenting commands, and producing output in clean tabular form or in one of several data formats you can feed into other tools or automation platforms.Immediately after
cookiecutter
generates the app directory, it sets up the Git repository for your new app withmain
anddevelop
branches and an initial version tag, ready to push to GitHub.The app directory is also pre-configured with these features ready to go:
Sphinx documentation for generation with ReadTheDocs including
cliff
autoprogram Sphinx integration for documenting commands from the same--help
output you get at the command line.Unit testing with pytest, Python security vulnerability scanning with bandit, integration and system testing with BATS (bats-core), and Python library dependency security scanning with GitHub’s dependabot.
Testing against Python versions 3.6, 3.7, 3.8, and 3.9 using Tox.
Version number bumping with a single command using bump2version and version number generation for packages and
--version
output using setuptools_scm.Workflow processing for automatic testing using GitHub Actions.
The GitHub Actions workflow will also auto-release packages to PyPI or Test PyPI when you push a new version tag on the
main
branch or a specialrc
tag on thedevelop
branch.