6.5 Using invoke to get command-line input
The invoke package is not part of the standard library. It needs to be installed separately. Generally, this is done with the following terminal command:
(cookbook3) % python -m pip install invoke
Using the python -m pip command ensures that we will use the pip command that goes with the currently active virtual environment, shown as cookbook3.
See the Using argparse to get command-line input recipe in this chapter. It describes a command-line application that works something like the following:
% RECIPE=7 # invoke
The command will always be invoke. The Python path information is used to locate a module file named tasks.py to provide the definitions of the commands that can be invoked. The remaining command-line values are provided to a function defined in the tasks module.
6.5.1 Getting ready
Often, we’ll create a two-tiered design when...