Command line for your package

In the previous post, I explained how to create a package.
Everyone also wants to use their package with command line so here the steps you can follow. The package we built named shortpath. The structure of our package was



Now add new script to it for accessing your package with command line




shortpath script will have some code like

#!/usr/bin/env python

import shortpath
print shortpath.some_method()

Now we have to declare our command script in


When we will be done with our installation of the package, setup tools will copy the script to our PATH and make the command available for general use.

$ shortpath



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s