We use Black to format our Python code. We use these changes to Black's default settings:
max-line-length = 100
(why do we allow up to 100 characters per line, unlike a lot of Python code that limits lines to 80 characters? For the same reason that Linus Torvalds recently changed the Linux kernel coding guidelines to allow up to 100 characters per line :) )
We use Ruff for all other code linting, such as docstrings, import sorting, and flake8. The .ruff.toml
in our repository template has the configuration that we use across all our repositories. This also allows easy local usage, as the only command that needs to run is ruff check
or ruff --fix
for code to be linted and some of the issues auto-fixed.
We use Google-style docstrings.
In terms of requirements around unittesting etc, please see our Pull Request template (which lists all the criteria we hope each pull request satisfies).
For now, we maintain the .py
files, and try to ensure they're all internally consistent, but we don't promise to maintain all our notebooks! (That might change if our code starts being used by lots of people!)
We use American English in our code (for example, so we use 'center' rather than 'centre'). This is true for variable namings and docstrings.
If making a new OCF Repository, please try using our template here which should help with boilerplate linting and setup.