Template for new Python projects

Requirements: pip, virtualenv, nose for testing.
Create a project skeleton (reference: learn python the hard way)

$ mkdir skeleton && cd skeleton
$ mkdir bin NAME tests docs
$ touch NAME/__init__.py
$ touch tests/__init__.py

Setup.py

try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

config = {
    'description': 'My Project',
    'author': 'My Name',
    'url': 'URL to get it at.',
    'download_url': 'Where to download it.',
    'author_email': 'My email.',
    'version': '0.1',
    'install_requires': ['nose'],
    'packages': ['NAME'],
    'scripts': [],
    'name': 'projectname'
}

setup(**config)

tests/NAME_tests.py:

from nose.tools import *
import NAME

def setup():
    print "SETUP!"

def teardown():
    print "TEAR DOWN!"

def test_basic():
    print "I RAN!"

Testing the setup:

$ nosetests

Setting up a Virtual Environment:

$ virtualenv ENV
$ source ENV/bin/activate

 

|