Language ignition

Python

Example text has a yellow background. You should replace the example text with the appropriate text for your situation.

Suggested text has a blue background. The suggested text should work fine, but you can replace it with an alternative of your choosing if you like.

Installation

# apt-get install python python-dev python-virtualenv

Start a new project

Create a file called README that describes your project to a human using reStructuredText.

Create a file called setup.py that contains meta-data for your project. Include any dependencies in the install_requires field.

#!/usr/bin/env python

import os
from setuptools import setup

def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(
    name='languageignition',
    version='0.1.0',
    description='Get started with a new language',
    long_description=read("README"),
    author='Michael Williamson',
    author_url='mike@zwobble.org',
    url='http://github.com/mwilliamson/language-ignition.com',
    packages=['languageignition'],
    install_requires=[
        'requests>=1.0,<2.0',
    ],
    license='BSD 2-Clause',
)

Create a file called test-requirements.txt that contains test dependencies:

nose>=1.3,<2.0
mock>=1.0,<2.0

Initialise your project

Make sure you're at the root of your project, which should contain setup.py

Create a virtualenv if you haven't already:

$ virtualenv venv
$ venv/bin/pip install distribute --upgrade

Install your project and its dependencies into the virtualenv:

$ venv/bin/pip install -e .

Install test dependencies into the virtualenv:

$ venv/bin/pip install -r test-requirements.txt

Install a library

Let's assume we want to install requests.

Create a virtualenv if you haven't already:

$ virtualenv venv
$ venv/bin/pip install distribute --upgrade

Install the library in the virtualenv:

$ venv/bin/pip install requests

Install a command-line tool

Let's assume we want to install tox.

Create a virtualenv for that tool:

$ mkdir -p ~/apps
$ virtualenv ~/apps/tox
$ ~/apps/tox/bin/pip install distribute --upgrade

Install the tool in the virtualenv:

$ ~/apps/tox/bin/pip install tox

Run the tool:

$ ~/apps/tox/bin/tox

Optionally create a symlink in a directory that's on your $PATH. Assuming ~/bin is on your path:

$ ln -s ~/apps/tox/bin/tox ~/bin