Installation¶
Three steps are necessary for installing autohooks:
Installing autohooks into the current environment
Activating the git hook
Installing and configuring the plugins to be run
For fulfilling these steps different tooling can be used. Most prominent and currently supported tools are:
Note
Using poetry is recommended for installing and maintaining autohooks.
1. Installing autohooks into the Current Environment¶
Fist of all autohooks needs to be installed to provide the CLI.
Hint
When using pip it might be necessary to adjust your PATH
to allow executing
the autohooks CLI without having to reference the full installation path later
on.
export PATH=$PATH:~/.local/bin
To install autohooks as a development dependency run
poetry add --dev autohooks
To install autohooks as a development dependency run
pipenv install --dev autohooks
To install autohooks globally for the current user run
python3 -m pip install --user autohooks
2. Activating the Git Hook¶
To actually use autohooks
when a git commit is created, it is required to
activate the git hook in every cloned git repository. This can be done by running
poetry run autohooks activate --mode poetry
pipenv run autohooks activate --mode pipenv
autohooks activate --mode pythonpath
3. Installing and Configuring the Plugins to Be Run¶
To finally execute a hook on your git commits, autohooks plugins have to be installed and configured. E.g. set up the Python linting via pylint plugin by executing
poetry add --dev autohooks-plugin-pylint
poetry run autohooks plugins add autohooks.plugins.pylint
pipenv install --dev autohooks-plugin-pylint
pipenv run autohooks plugins add autohooks.plugins.pylint
python3 -m pip install --user autohooks-plugin-pylint
autohooks plugins add autohooks.plugins.pylint