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-templateto produce a bare-bones functional Python CLI app built on the OpenStack cliff – Command Line Interface Formulation Framework.cliffprovides 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
cookiecuttergenerates the app directory, it sets up the Git repository for your new app withmainanddevelopbranches 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
cliffautoprogram Sphinx integration for documenting commands from the same--helpoutput 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
--versionoutput 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
mainbranch or a specialrctag on thedevelopbranch.