problems with lychee pre-commit installation
- With the following pre-commit configuration as per the README.md, running "pre-commit run --all lychee" fails with error "Executable
lycheenot found". I had tocdinto the pre-commit environment and manually run "make install".
- repo: https://github.com/lycheeverse/lychee.git
rev: v0.15.1
hooks:
- id: lychee
# Optionally include additional CLI arguments
args: ["--no-progress", "--exclude", "file://"]
- Above v0.15.1, the rev pre-commit field must have the syntax "lychee-v0.1X.X". Is this intended? All pre-commit hooks I've seen have revisions with format "v9.9.9"
thanks
It looks like there are two distinct issues being reported:
- Pre-commit hook installation failure
The error "Executable
lycheenot found" suggests the pre-commit hook isn't properly installing the lychee binary. Having to manuallycdinto the pre-commit environment and run "make install" shouldn't be necessary. This likely indicates an issue with the hook's installation script.
Have you tried any of these steps?
- Clearing your pre-commit cache:
pre-commit clean - Updating pre-commit:
pre-commit autoupdate
- Version tag format change The prefix was automatically added when we switched to release-plz. I'm not too happy with that change, as it caused many problems. At the moment, I wouldn't want to switch back to non-prefixed releases as I know it will break a lot of things again. Sorry about that.
Does that mean you changed the above version string from rev: v0.15.1 to rev: lychee-v0.15.1?
If not, you can try adapting your pre-commit config like this to see if it works out of the box:
- repo: https://github.com/lycheeverse/lychee.git
rev: lychee-v0.18.1 # If using newer versions
hooks:
- id: lychee
args: ["--no-progress", "--exclude", "file://"]
(You probably have to re-install the hook.)
Would you be able to provide:
- Your operating system details
- The output of
pre-commit --version
This would help us identify if this is a broader issue that needs to be addressed in the documentation or codebase.
Also, I wonder if someone else got it to work? If there's anyone reading this who uses the pre-commit configuration, please add a comment.
Also, I wonder if someone else got it to work? If there's anyone reading this who uses the pre-commit configuration, please add a comment.
Hi I am facing the same issue as well.
pre-commit configuration:
repos:
- repo: https://github.com/lycheeverse/lychee.git
rev: lychee-v0.18.1
hooks:
- id: lychee
args: ["--no-progress", "."]
pass_filenames: false
Information:
Operating system: macOS Sequoia (Version 15.3) Pre-commit version: pre-commit 4.1.0
Thanks. Does it work if you change it to this?
repos:
- repo: https://github.com/lycheeverse/lychee.git
rev: lychee-bin-v0.18.1
hooks:
- id: lychee
args: ["--no-progress", "."]
pass_filenames: false
With lychee-bin-v0.18.1
pre-commit run --all lychee
[INFO] Initializing environment for https://github.com/lycheeverse/lychee.git.
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'checkout', 'lychee-bin-v0.18.1')
return code: 1
stdout: (none)
stderr:
error: pathspec 'lychee-bin-v0.18.1' did not match any file(s) known to git
Check the log at /home/dani/.cache/pre-commit/pre-commit.log
With lychee-v0.18.1
pre-commit run --all lychee
[INFO] Initializing environment for https://github.com/lycheeverse/lychee.git.
lychee...................................................................Failed
- hook id: lychee
- exit code: 1
Executable `lychee` not found
With lychee-bin-v0.18.1
pre-commit run --all lychee [INFO] Initializing environment for https://github.com/lycheeverse/lychee.git. An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'checkout', 'lychee-bin-v0.18.1') return code: 1 stdout: (none) stderr: error: pathspec 'lychee-bin-v0.18.1' did not match any file(s) known to git Check the log at /home/dani/.cache/pre-commit/pre-commit.logWith lychee-v0.18.1
pre-commit run --all lychee [INFO] Initializing environment for https://github.com/lycheeverse/lychee.git. lychee...................................................................Failed - hook id: lychee - exit code: 1 Executable `lychee` not found
I face the same exact error as you too
Clearly I don't know how pre-commit hooks, but has anyone tried this?
- repo: https://github.com/lycheeverse/lychee.git
rev: lychee-v0.18.1
hooks:
- id: lychee-bin
It doesn't work either
(sc-api) ➜ sc-api git:(regression-forest-no-logger) ✗ pre-commit run --all lychee-bin
[INFO] Initializing environment for https://github.com/lycheeverse/lychee.git.
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'checkout', 'lychee-bin-v0.18.1')
return code: 1
stdout: (none)
stderr:
error: pathspec 'lychee-bin-v0.18.1' did not match any file(s) known to git
Check the log at /home/dani/.cache/pre-commit/pre-commit.log
I think the problem is that lychee's yaml specifies system, which requires the binary to be compiled.
Maybe you can get inspiration from ruff config, which is also developed in rust https://github.com/astral-sh/ruff-pre-commit/blob/main/.pre-commit-hooks.yaml
Btw, pre-commit run lychee-docker does work
I took a stab at it in #1829.
The main problem is that precommit-hooks don't work well with Rust workspaces yet, as far as I can see. The workaround is a custom script which triggers the installation process on-demand. I made a small optimization to use cargo binstall if it's available. This could speed up the installation process a bit. We fall back on cargo install.
Does that work for all of you? I would appreciate any feedback on this approach.
I merged the PR, which hopefully fixes the issue. Nevertheless, I'd still like to get some feedback here, so in case someone reads this, please post a comment if you tried it, and it works / doesn't work for you. 🙏
Seems to work as reported in https://github.com/lycheeverse/lychee/pull/1829#issuecomment-3244464383. Closing. 😃
Hi, any plans to make a release with this soon?
thanks