Coding style
In terms of coding style, we try to adhere to PEP8 and use Google Style docstrings.
The docstring convention might be best learned by example.
The documentation, including the docstrings, are written using reStructuredText, with examples in the
following cheatsheet.
To ensure the integrity of the code, we also try to provide many test functions,
which are typically contained in separate modules in sub-packages called
tests.
These tests can be ran using scripts in the tests subfolder in the root
folder.
This folder also contain a script tests_types.sh, which uses mypy
to check the consistency of the python type annotations.
We use these type annotations for additional documentation and they have also
already been useful for finding some bugs.
We also have some conventions that should make the package more consistent and
thus easier to use. For instance, we try to use properties instead of getter
and setter methods as often as possible.
Because we use a lot of numba just-in-time compilation to speed up computations,
we need to pass around (compiled) functions regularly. The names of the methods
and functions that make such functions, i.e. that return Callables, should start
with ‘make_*’ where the wildcard should describe the purpose of the function
being created.