-
Notifications
You must be signed in to change notification settings - Fork 111
Developer Guide
Tom Van Mele edited this page Nov 4, 2019
·
6 revisions
This guide provides basic information about setting up a development environment and writing code for the COMPAS framework.
For instructions on how to submit contributions, see Contributions
- clone repo
- install from source (dependencies + dev tools)
$ pip install -r requirements-dev.txt
- US English
In general, we use the __all__ variable to explicitly declare a public module API. The if __name__ is "__main__" guard is used to test the examples declared in docstrings. We do three from __future__ imports to provide compatibility with Python 2.7x.
We define one class per module. Two blank lines are inserted before and after the class definition.
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
__all__ = ['MyClass']
class MyClass(object):
pass
# ==============================================================================
# Main
# ==============================================================================
if __name__ == "__main__":
import doctest
doctest.testmod(globs=globals())
- We use the sphinxcontrib extension Napoleon - Marching towards legible docstrings (https://sphinxcontrib-napoleon.readthedocs.io/en/latest/)
- We prefer Numpy-style docstrings (https://numpydoc.readthedocs.io/en/latest/format.html)
- We use pytest for writing unit tests