You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a pre-commit hook that simply runs rye lock to ensure that requirements.lock is up to date with pyproject.toml. This is supposed to act similarly to the poetry-lock pre-commit hook.
The text was updated successfully, but these errors were encountered:
I've tried to create a hook myself, but there is no straightforward way. You would expect that you could add a .pre-commit-hooks.yaml file like this:
- id: rye-lockname: rye-lockdescription: Run rye lock to update lock filesentry: rye locklanguage: rustpass_filenames: falsefiles: ^(.*/)?(requirements(-dev)?\.lock|pyproject\.toml)$
Unfortunately, pre-commit internally runs cargo install --bins --path ., which results in the error error: found a virtual manifest at <path> instead of a package manifest. Running cargo install --bins --path ./rye instead does work, but the pre-commit maintainer is against making --path configurable.
I tried to make a hook that relies on the host installation of rye instead like this:
- id: rye-lockname: rye-lockdescription: Run rye lock to update lock filesentry: rye.exe locklanguage: systempass_filenames: falsefiles: ^(.*/)?(requirements(-dev)?\.lock|pyproject\.toml)$
This works, but only on Windows, as you need to call rye.exe instead of just rye, so this hook is now platform-dependent.
You could also create a docker file and make use that in a docker pre-commit hook, but I don't think that is a good solution as you would need to install docker on your host machine.
Anyway, I hope that my findings will be a useful starting point for whoever wants to pick up on this.
Add a pre-commit hook that simply runs
rye lock
to ensure thatrequirements.lock
is up to date withpyproject.toml
. This is supposed to act similarly to the poetry-lock pre-commit hook.The text was updated successfully, but these errors were encountered: