Tutorial for writing command line applications using click.
Abstract: https://www.pytennessee.org/schedule/presentation/117/
Repo: https://github.com/tylerdave/PyTN2016-Click-Tutorial
Slides: https://speakerdeck.com/tylerdave/pytennessee-2016-writing-command-line-applications-that-click
Follow-up: http://daveops.com/pytn2016
Know all about installing and developing Python packages and don't feel like reading the rest?:
- Have Git and Python installed
- Create and activate a virtualenv
- Clone this repo (or your own fork of it) and
cd
to it. - Install the package in editable mode:
pip install -e .
In order to make use of this tutorial you will a system with the following installed:
- Git
- Python (2.7, 3.3, 3.4, 3.5)
If you do not already have these installed, follow these directions:
The virtualenv package allows you to create isolated environments for developing Python code.
To make sure it is installed, run this command:
pip install virtualenv
or on Windows (if the above doesn't work):
python -m pip install virtualenv
This will either install the package or let you know it's already installed. If it is already installed, you will see:
Requirement already satisfied (use --upgrade to upgrade)
Create a virtualenv for this tutorial:
virtualenv click_tutorial
Activate the virtualenv:
source click_tutorial/bin/activate
or on Windows:
click_tutorial\Scripts\activate
(Optional) Fork this repo on GitHub
Clone the repo locally (using either this repo's URL or that of your new fork.)
git clone https://github.com/tylerdave/PyTN2016-Click-Tutorial.git pytn
The tutorial repo is configured to be a Python package in order to ease installation.
In a terminal/console
cd
to cloned tutorial directory:cd pytn
Install the package in editable mode:
pip install -e .
Run tests to verify installation:
py.test -v tests/
Verify that all tests report PASSED
Once installed, the tutorial
command should be available.
See usage information
tutorial --help