Configuration

For its configuration, autohooks uses the pyproject.toml file specified in PEP518. This file is adjusted when using the autohooks CLI but can also be changed manually.

Adding a [tool.autohooks] section allows to specify the desired autohooks mode and to set python modules to be run as autohooks plugins.

Mode Configuration

The mode can be set by adding a mode = line to the pyproject.toml file. Current possible options are "pythonpath", "pipenv" and "poetry" (see autohooks mode). If the mode setting is missing, the pythonpath mode is used.

Example pyproject.toml:

[tool.autohooks]
mode = "poetry"

Calling autohooks activate also allows for overriding the mode defined in the pyproject.toml settings:

poetry run autohooks activate --mode poetry --force

Please keep in mind that autohooks will always issue a warning if the mode used in the git hooks is different from the configured mode in the pyproject.toml file.

The activation can always be verified by running autohooks check.

Plugins Configuration

Afterwards, the pylint plugin can be configured to run as a pre-commit git hook by adding the autohooks-plugins-pylint Python module name to the pre-commit setting in the [tool.autohooks] section in the pyproject.toml file.

Example pyproject.toml:

[tool.autohooks]
mode = "poetry"
pre-commit = ["autohooks.plugins.pylint"]

Alternatively the autohooks plugins CLI can be used to manage the plugins.

poetry run autohooks plugins add autohooks.plugins.pylint