Removed the requirement for a particular version of Python in pre-commit #925
+5
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've realised that this only works if you have that particular version of Python installed locally -- pre-commit doesn't download this for you.
This unacceptably raises the bar for making contributions -- folks shouldn't have to modify their global system just to offer a PR against Equinox.
Unfortunately this has meant that I've had to remove a couple of dependencies from the
additional_dependencies
list, as they don't support Python 3.13, which is what is sometimes selected.(Alternatives considered:
Install the specified version of Python as part of the pre-commit hook. This would be ideal. Unfortunately
pre-commit
passes the specifiedlanguage_version
topython -m virtualenv
under the hood, and that doesn't seem to offer a way to do this.Based on the above: something with
uv
? Unfortunatelypre-commit
have also elected not to supportuv
(Add support foruv
-based venvs/install viaPRE_COMMIT_USE_UV
pre-commit/pre-commit#3131, Python language: add option to use uv instead of pip for venv creation & dependency installs pre-commit/pre-commit#3222), which would have done this automatically. Maybe we just need to wait until the folks at Astral write their own version of pre-commit as well!Specify a range of versions for Python, so that we use whatever the system Python is, as long as it is below 3.13. Unfortunately pre-commit doesn't seem to support this.
Write our own local hook that does whatever we damn well please:
uv
to install the right version of Python, downloads pyright, and run it. If this becomes problematic amongst the rest of the ecosystem then it may be worth doing exactly this.)