- start with verb in infinitive form
- be reasonably specific
- e.g. "Add new sinogram plotting function to tools/sinogram.py"
- add
WIPto the begining of commit message if changes are not ready for implementation
- never use star imports eg.
# NEVER use
from numpy import *
# correct way
import numpy as np- np for numpy
- plt for matplotlib.pyplot
-
Use numpy style docstrings, example below
https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html -
Skip first line in multiline docstrings.
-
Write documentation for __init__ to its own docstrings
class Foo(object):
"""
First line of docstring with class description
Attributes
----------
attr
sum of first two parameters
"""
def __init__(self, param1, param2):
"""
Documentation of __init__
Parameters
----------
param1
first param of __init__
param2
second param of __init__
"""
self.attr = param1 + param2
return