Uberspace / lab

The Uberlab provides various tutorials - written by you! - on how to run software and tools on Uberspace 7.
https://lab.uberspace.de
Other
308 stars 406 forks source link

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

Open bliepp opened 2 months ago

bliepp commented 2 months ago

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.)