Boilerplate code for making a Python 2.7+ package
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
mypackage
README.rst
distribute_setup.py
setup.py

README.rst

Python Boilerplate

The name of the directory, python-boilerplate, is also the name of the distribution. This distribution contains a package called mypackage. An example usage of this package:

#!/usr/bin/env python

from mypackage.mymodule import foo, bar, baz

print(foo(), bar(), baz())

This boilerplate code is meant to support Python 2.7+ (although there’s no reason it can’t support earlier versions).

Installation

This distribution is installable via standard setup.py usage. Note that Distribute will be installed as part of the setup process (if it isn’t already):

$ python setup.py install

Because setup.py specifies an entry point as a console script, mybin will be installed into your Python's bin/ directory

Unit Tests

Unit tests are run from the setup.py target test:

$ python setup.py test