Sponsors

<-- Back to schedule

How to write a well-behaved Python command line application

Python is a fantastic scripting language. It is easy to hack up quick scripts for all sorts of problems - without a lot more effort, that hack can become a robust, easily maintained command line application that your users love.
Come along to learn how to write useful, well-behaved command line applications that are a joy to use.

You will learn how to:

* Easily process command line options
* Write a script that can be used interactively or as a filter
* Display help to the user
* Gracefully handle and report errors, to the user and the shell
* Trap and process signals in a robust manner
* Create an easily configured application

* Use a range of the Python standard library modules for easier command line scripting
* Test your application
* Set up the supporting files that any well-behaved application should have, eg. a man page
* How to package your application for other people to use

This tutorial will assume a very basic knowledge of Python and some familiarity with the command line environment of your choice.

We will use bash (running on Linux or Mac OS X) as our default platform, but we will also show how these applications can run with the Windows command prompt.

Graeme Cross

Graeme mixes chemistry and software, usually without too many explosions. He has been programming in Python since the mid-1990s and works as a biomedical instrument developer for Planet Innovation in Melbourne.
Graeme's other interests include trail running, music of almost every genre, fatherhood and sustainable transport activism.