Wrong shebang line generated for my setyp (Windows10 + pyenv-win + pre-commit installed in virtual env)
See original GitHub issuepre-commit generates the following shebang in the hook:
#!/usr/bin/env python.exe
It works when I have a virtual env activated, but not outside because I install python with pyenv-win that makes python accessible through a python
shim installed in %USERPROFILE%\.pyenv\pyenv-win\shims\python
.
Right now my workaround is to edit manually the hook and replace “python.exe” with “python”. I don’t want to change my PATH to have “python.exe” accessible from it because I may change the global python I use with pyenv and I would have to remember to update my PATH in that case.
Is there a command line argument to specify the command to use in the shebang ? (I don’t see any with pre-commit --help
or pre-commit install --help
). If not do you think it would be a good idea to offer such option ?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top GitHub Comments
Ok the pipeline finished and the only test that fail is
test_shebang_windows
. I’m updating the pull request with updated tests.the problem with that is that executable often points at a virtualenv which can go missing (most of the git hook script is trying to re-discover a suitable pre-commit executable)