Project scaffolding to develop Command Line Interface (CLI) applications using Python.
Environment:
- Operating system: Ubuntu 22.04
- Python interpreter: Python 3.10
-
Install python3 using Ansible and ansible-ctrl/roles/dev
-
Install application and development dependencies into a virtualenv
pipenv install --dev
-
Activate the virtualenv
pipenv shell python --version > Python 3.10.6 -
Run a command
# Run as a Python module python -m cliapp python -m cliapp hello --name andornaut # Run as a CLI application cliapp --version > cliapp v0.1.0
| Name | Description |
|---|---|
| black | The uncompromising Python code formatter |
| pytest | A framework that makes it easy to write small, readable tests |
| Typer | Build great CLIs. Easy to code. Based on Python type hints. |
See .vscode for VS Code integration files.
# Format Python files
black .
# Check code style
flake8
# Run tests
pytest
# Run only tests whose names contain "version"
pytest -k version