18.11.2012 Views

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ASE</strong> <strong>Manual</strong>, <strong>Release</strong> 3.6.1.2828<br />

• Use ‘single quotes’ for string literals, and “”“triple double quotes”“” for docstrings. Double quotes are OK<br />

for something like "don’t".<br />

Attention: Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the<br />

number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent,<br />

nor either indent thou two, excepting that thou then proceed to four. Tabs are right out.<br />

Georg Brandl<br />

General advice<br />

• Get rid of as many break and continue statements as possible.<br />

Writing documentation in the code<br />

Here is an example of how to write good docstrings:<br />

http://projects.scipy.org/numpy/browser/trunk/doc/example.py<br />

Run pep8.py on your code<br />

The pep8.py program is installed together with <strong>ASE</strong> tools/pep8.py. It will check the PEP8 conventions for you.<br />

Try:<br />

$ pep8.py --help<br />

Using pylint to check your code<br />

A pylintrc trying to follow <strong>ASE</strong> Coding Conventions can be found here: doc/development/pylintrc<br />

Running pylint yourself<br />

Run pylint on a single file like this:<br />

[~]$ pylint mypythonfile.py<br />

Run pylint on a module like this:<br />

[~]$ pylint path/to/module/root/dir<br />

Output from pylint run on <strong>ASE</strong><br />

• pylint_ase<br />

Run epydoc on your code<br />

Run:<br />

$ epydoc --docformat restructuredtext --parse-only --show-imports -v dir<br />

11.1.6 Writing documentation<br />

We use the Sphinx tool to generate the documentation (both HTML and PDF). The documentation is stored in<br />

SVN as text files in the doc directory using the reStructuredText markup language.<br />

190 Chapter 11. <strong>ASE</strong> development

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!