Developer documentation

Please refer to the scanpy developer guide.

Pre-commit documentation

Pre-commit checks are fast programs that check code for errors, inconsistencies and code styles, before the code is committed. This is a brief documentation of pre-commits checks pre-sets in the scverse-template.

The following pre-commit checks for code style and format.

  • black: standard code formatter in Python.

  • autopep8: code formatter to conform to PEP8 style guide.

  • isort: sort module imports into sections and types.

  • prettier: standard code formatter for non-Python files (e.g. YAML).

  • blacken-docs: black on python code in docs.

The following pre-commit checks for errors, inconsistencies and typing.

  • flake8: standard check for errors in Python files.

  • yesqa: remove unneccesary # noqa comments, follows additional dependencies listed above.

  • autoflake: remove unused imports and variables.

  • pre-commit-hooks: generic pre-commit hooks.

    • detect-private-key: checks for the existence of private keys.

    • check-ast: check whether files parse as valid python.

    • end-of-file-fixer:check files end in a newline and only a newline.

    • mixed-line-ending: checks mixed line ending.

    • trailing-whitespace: trims trailing whitespace.

    • check-case-conflict: check files that would conflict with case-insensitive file systems.

  • pyupgrade: upgrade syntax for newer versions of the language.

Notes on pre-commit checks

  • flake8: to ignore errors, you can add a comment # noqa to the offending line. You can also specify the error id to ignore with e.g. # noqa: E731. Check flake8 guide for reference.

  • You can add or remove pre-commit checks by simply deleting relevant lines in the .pre-commit-config.yaml file. Some pre-commit checks have additional options that can be specified either in the pyproject.toml or pre-commit specific config files, such as .prettierrc.yml for prettier and .flake8 for flake8.