Uberspace/lab

`pre-commit` python version mismatch and outdated `black` hooks repository

bliepp opened this issue · 0 comments

Hello there,

on my machine I get an error when running make setup. Some investigation showed that setup-venv finished successfully while setup-pre-commit fails with an InvalidManifestError. Also, it prevents from commits being made to this repo / or a fork of it). Full error message:

[... venv setup and package inatallation ...]
Successfully installed [... alll the packages ...]
.venv/bin/pre-commit install --overwrite --install-hooks
pre-commit installed at .git/hooks/pre-commit
An error has occurred: InvalidManifestError: 
==> File /home/bliepp/.cache/pre-commit/repo9cqtpufl/.pre-commit-hooks.yaml
==> At Hook(id='black')
==> At key: stages
==> At index 0
=====> Expected one of commit, commit-msg, manual, merge-commit, post-checkout, post-commit, post-merge, prepare-commit-msg, push but got: 'pre-commit'
Check the log at /home/bliepp/.cache/pre-commit/pre-commit.log
make: *** [Makefile:28: setup-pre-commit] Fehler 1

I'm using Manjaro Linux and tried with Python3.8 and 3.11.

When replacing https://github.com/psf/black with https://github.com/psf/black-pre-commit-mirror in .pre-commit-config.yaml this error went away, but it then complained about not finding the interpreter of python3.10 (I haven't installed it, so duh). Changing the python version in .pre-commit-config.yaml back to python3.8 (the same this repo uses according to runtime.txt) fixed it.

(I just realized the first part about "black" hook repo being outdated seems like it's related to #1733 and #1737.)