Our source code style based on PEP-8.

Some points:

  • max. line length: 110 characters.
  • No Python shebang! (Only needed in the dispatcher files)
  • Source code encoding always utf-8 (lower)
  • copyleft info:
    • copyleft not copyright ;)
    • always by "the PyLucid team" (New authors should be inserted in AUTHORS file!)
    • you can insert author info (like "based on sourcecode by..." or "created by...") into the normal header DocString.
  • We use GPL v3 or above
  • no TABs, use only 4 spaced to indent
  • We use linux like line endings: "\n"

The source code header should look like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# coding: utf-8

"""
    the Headline
    ~~~~~~~~~~~~

    Some Info about the file.

    :copyleft: 2011 by the PyLucid team, see AUTHORS for more details.
    :license: GNU GPL v3 or above, see LICENSE for more details.
"""

...

PyDev code formatter settings

Window -> Preferences -> Pydev -> Editor -> Code Style -> Code Formatter

PyDev code formatter settings

One of the important switch to enable is:

  • On save, only apply formatting in changed lines?