Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Python

Documentation

See documentation in the general section first.

For in-line comments, use Google style of Python DocStrings. Use DargLint and PyDocStyle pre-commit hooks for enforcing compliance and detecting style issues in DocStrings.

Pre-commit hooks

Black

Python linter

Example config:

- repo: https://github.com/psf/black
  rev: 21.11b1
  hooks:
    - id: black
      args:
        - --line-length=72

Documentation

Flake8

Python formatter

Example config:

- repo: https://gitlab.com/pycqa/flake8
  rev: 3.9.2
  hooks:
    - id: flake8
      additional_dependencies:
        - flake8-bugbear
          args:
      # these settings are needed to make flake8 compatible with black
        - --max-line-length=88
        - --select=C,E,F,W,B,B950
        - --extend-ignore=E203,E501

Documentation

Darglint

DocStyle linter

Example config:

- repo: https://github.com/terrencepreilly/darglint
  rev: v1.8.1
  hooks:
    - id: darglint
      args:
        - -v 2

Documentation

PyDocStyle

Additional linter (complementary to Darglint)

Example config:

- repo: https://github.com/PyCQA/pydocstyle
  rev: 6.1.1
  hooks:
    - id: pydocstyle

Documentation

PyUpgrade

Automatically upgrade syntax for newer versions of Python

Example config:

- repo: https://github.com/asottile/pyupgrade
  rev: v2.29.1
  hooks:
    - id: pyupgrade

Documentation

Setup Config Format

Apply a consistent format to setup.cfg files

Example config:

- repo: https://github.com/asottile/setup-cfg-fmt
  rev: v1.20.0
  hooks:
    - id: setup-cfg-fmt

Documentation

Python Dependencies Safety Check

Checks for known vulnerabilities in used dependencies

Example config:

- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
  rev: v1.2.2
  hooks:
    - id: python-safety-dependencies-check

Documentation