question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pre-commit should install correct python version

See original GitHub issue

What? 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 in python.py
  • could potentially use pyenv to handle the installs

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
asottilecommented, Nov 27, 2018

also pyenv doesn’t even work without also installing another toolchain or two. For example it requires an http downloader globally installed, and requires libssl-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

1reaction
ned2commented, Jan 15, 2019

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 for language_version was this:

pyenv: python3.7: command not found

The `python3.7' command exists in these Python versions:
  3.7.0
  3.7.2

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 plain 3.7.2 installation, it is registered.

At any rate, python3 is a registered command in my virtualenv, so it looks like the value of python3 forlanguage_version makes everyone happy.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found