Style

Grove ships with several tool configuration(s) which are used to enforce consistency.

Various linters are run during linting (via Tox) and any errors in output should be resolved before raising a pull-request.

To assist with this, “auto-formatters” are configured for Visual Studio Code. If using VSCode to develop Grove, the .vscode/settings.json configuration in root of the Grove repository will automatically tell VSCode to run auto-formatters on file save.

Auto-formatting

Although installed as part of the tests extra, the following tools are used to enforce style related concerns.

  • Code should be auto-formatted using Black.

  • Code must adhere to PEP8.

  • Imports must be sorted and consolidated using isort.

Validation against PEP8 is performed using flake8 as part of linting runs.

Documentation

Grove uses Sphinx for documentation generation. In order to keep generated API documentation up to date, docstrings and type annotations must be used.

  • reST (reStructured Text) format must be used for docstrings.

  • PEP484 type annotations must be used.