Coding Guidelines

When contributing to the pyhole project, please be sure to read over the following information.

Python Style

General

  • Two newlines between toplevel imports, classes, functions, etc
  • One newline between anything not mentioned above
  • Make an honest effort at not catching all exceptions
  • Do not name anything the same as builtin or reserved words
  • Use double quotes (“) whenever possible
  • Everything must be PEP8-compliant: http://www.python.org/dev/peps/pep-0008/

Imports

  • Import only modules
  • Import one module per line
  • Imports are grouped by import and from
  • Imports should be in alphabetical order in their groups
import json
import re

from BeautifulSoup import BeautifulSoup

from pyhole.core import plugin
from pyhole.core import utils

Docstrings

"""This is a single-line docstring."""

"""This is a multi-line docstring.

Second paragraph goes like this. Ending quotes are on their own line.
"""

Testing

Every new piece of code must be covered by a unit test. One must also ensure that all tests pass before submitting code. Testing examples can be found in the pyhole/tests directory.