Code Style#

The project uses variety of tools (including formatters and linters) to ensure the code is written in a consistent manner.

  • For formatting Python files, use the latest black.

  • For linting, use the latest ruff. Ruff is also used to sort imports.

Make sure you have pre-commit in your environment and project hooks are installed to your Git directory. Pre-commit configuration includes other useful checks as well as the tools listed above.

Here is a checklist you can use just before committing:

  • Check pre-commit hooks are passing:

    make format
    
  • Check typing errors:

    make type
    
  • Run tests:

    make test
    

    Additionally, you may check coverage stats to see if you have missed any important lines:

    make coverage
    

    Warning

    If you have changed any of the project dependencies (e.g. Python requirements or Docker image tags), you need to rebuild Docker image(s) before running tests.

  • If new documentation is added, make sure it builds and content is rendered properly:

    make docs
    
  • Finally, if developing an API, check the OpenAPI documentation. It should render properly and present appropriate information.