From charlesreid1

Revision as of 01:05, 19 March 2015 by Admin (talk | contribs)

A skeleton Python package takes the following structure:

myproject/

    setup.py

    myproject/
        __init__.py
        code.py
        submodule/
            somecode.py
            morecode.py

    tests/
        test_code.py
        test_somecode.py
        test_morecode.py


Setup.py

Here's what the package setup file looks like:

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)

Test_code.py

It is important to test your code. Here's a skeleton nose test suite:

from nose.tools import *
import NAME

def setup():
    print "setup"

def teardown():
    print "tear down"

def test_basic():
    print "i run good"

References