This boilerplate uses Pipenv to manage dependencies and its virtual environment. You will need to install it if you do not already have it.
Use Pipenv to create a virtual environment and install the dependencies set in the Pipfile
. Setting the --dev
flag will include the (optional) development dependencies.
pipenv install --dev
Scripts set within the Pipefile
provide a convinient way to run shell commands. They allow you to define shortcuts for commonly-used commands, regardless of whether they need to be executed within a virtual environment or not. To run a script, you simply prefix it with pipenv run
.
If this in your Pipefile
(Look, it is!)
[scripts]
start = "pipenv run python -m my_app --text '1. Check it out!'"
clean = "rm -rf docs && rm -rf reports"
Then
-
pipenv run start
executes the commandpython -m my_app --text '1. Check it out!'
within the virtual environment -
pipenv run clean
executes the simple shell commandrm -rf docs && rm -rf reports
which doesn't require any virtual environment
Installation and Package Management with Pipenv
Pipenv – A production-ready tool that aims to bring the best of all packaging worlds to the Python world. It harnesses Pipfile, pip, and virtualenv into one single command.
Install pipenv
:
pip install --user pipenv
Pylint – Analyses your code without actually running it. It checks for errors, enforces a coding standard, looks for code smells, and can make suggestions about how the code could be refactored.
Install pylint
:
pipenv install -d pylint
Black – Cedes control over minutiae of hand-formatting.
Installblack
:
pipenv install -d black
Testing and Coverage with Pytest and Pytest-cov
Pytest – Framework that makes it easy to write small, readable tests, and can scale to support complex functional testing for applications and libraries.
Install pytest
:
pipenv install -d pytest
Pytest-cov – Pytest plugin for measuring coverage.
Install pytest-cov
:
pipenv install -d pytest-cov
Documentation with Pdoc3
Pdoc3 – Auto-generate API documentation for Python projects.
Install pdoc3
:
pipenv install -d pdoc3
Command-Line Argument Parsing with Argparse
Argparse – Parser for command-line options, arguments and sub-commands.
Install argparse
:
pipenv install argparse