To install precommit, run the following in a virtualenv (and while in a git repo).
pip install pre-commit
You can confirm everything is installed by running;
pre-commit --help
To generate a new settings file locally, you need to run;
pre-commit sample-config > .pre-commit-config.yaml
Don't forget to install the hooks.
pre-commit install
Now you're ready to run the hook.