Pre-commit should install correct python version
See original GitHub issueWhat? Pre-commit should install the correct version(s) of python required for running hooks.
Why?
#869 shows language_version
as the correct way to specify a dependency for a hook. However this isn’t acted on by pre-commit at the install stage, so at run time the hook doesn’t have that python version available. This violates the purpose of the library:
Some of the best linters are written in languages that you do not use in your project or have installed on your machine. For example scss-lint is a linter for SCSS written in Ruby. If you’re writing a project in node you should be able to use scss-lint as a pre-commit hook without adding a Gemfile to your project or understanding how to get scss-lint installed.
Notes:
ruby.py
contains an_install_ruby
function, but the equivalent appears missing inpython.py
- could potentially use
pyenv
to handle the installs
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
pre-commit
Run pre-commit install to install pre-commit into your git hooks. pre-commit will now run on every commit. Every time you clone a project...
Read more >The hook `black` requires pre-commit version 2.9.2 but ...
I tried changing version of black from stable to the most recent, but nothing helps. Any ideas how I can do to troubleshoot...
Read more >How to Set up Pre-Commit Hooks in Python
Pre-commit hooks can be described as a mechanism of the version control, Git. ... You can check that it was correctly installed by...
Read more >Install pre-commit Hook for ESP-IDF Project - Espressif Systems
This is our recommendation python version for IDF developers. If you still have versions not compatible, please do not install pre-commit hook and...
Read more >Python Pre-Commit Hooks Setup in a single video! - YouTube
A one-stop-shop for setting up and configuring Python Pre-commit git hooks in one video. ... Your browser can 't play this video.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
also
pyenv
doesn’t even work without also installing another toolchain or two. For example it requires an http downloader globally installed, and requireslibssl-dev
/gcc
/ etc. to be system installed on linuxes.There aren’t great binary distribution methods for python and building from source is a real struggle. Distributions themselves are much better at providing a working binary
Chiming in a bit late to the party as I just ran into this issue with pyenv.
The error message I got after using
python3.7
as the value forlanguage_version
was this:It seems as though pyenv has not not registered
python3.7
as a command for my virtualenv (which is based on 3.7.2). Strangely, when I activate the plain3.7.2
installation, it is registered.At any rate,
python3
is a registered command in my virtualenv, so it looks like the value ofpython3
forlanguage_version
makes everyone happy.