Style Guide¶
Coding Style¶
Code follows the Python PEP8 style guide. This is enforced via the black formatter and the pre-commit hook set up in Getting Started For Developers.
You can also use black \<filename\>
to reformat your code by hand or install
editor plugins.
API Documentation Style¶
All functions, classes, and modules should contain appropriate API documentation in their docstrings. The docstrings should be written in ReStructuredText format (same as the Sphinx high-level documentation), and should follow the NumPy Docstring Standards
Documentation for all algorithms should contain citations to external
works, which should be collected in bibliography.rst
. An example of
citing a reference in that file:
this algorithm is an implementaton of [author2003]_
Interactive Development Environment¶
It is recommended that a fully python-aware interactive development environment (IDE) is used to develop code, rather than a basic text editor. IDEs will automatically mark lines that have style problems. The recommended IDEs are:
PyCharm CE (Jetbrains)
emacs with the elpy package installed
PyDev (Eclipse)
The IDEs provide a lot of support for avoiding common style and coding
mistakes, and automatic re-formatting (e.g. M-x py-autopep8-buffer
in emacs)