Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to enforce default_language_version to enforce python_venv #1370

Closed
ssbarnea opened this issue Mar 19, 2020 · 5 comments
Closed

Unable to enforce default_language_version to enforce python_venv #1370

ssbarnea opened this issue Mar 19, 2020 · 5 comments

Comments

@ssbarnea
Copy link

ssbarnea commented Mar 19, 2020

I tried to use the documented default_language_version override feature in order to enforce use of python3 + venv for creation of all virtualenvs but apparently this does not work as one would expect.

default_language_version:
  # avoid use of virtualenv which recently become unstable
  python: python_venv

https://github.com/pre-commit/pre-commit/search?q=python_venv&unscoped_q=python_venv

Is there a way to enforce this without having to touch each hook? In some repositories there lots of hooks defined.

Background

It seems that newer virtualenv releases stated to become more unstable, example pypa/virtualenv#1740

@asottile
Copy link
Member

default_language_version is for overriding language_version, not language so I'm not sure why you expected that :)

if you're worried about the stability of virtualenv 20.x I'd suggest virtualenv<20 in your requirements -- that said, virtualenv 20.x has a setting to use venv, so that's probably a better option

@asottile
Copy link
Member

note also, language: python_venv will be going away soon/eventually as virtualenv is now making venv-style environments

@ssbarnea
Copy link
Author

ssbarnea commented Mar 19, 2020

So basically, by capping virtualenv version when I install, pre-commit I avoid being affected by this issue. Thanks, lucky me I am using tox, so very easy.

I do not mind seeing python_venv feature being dropped, I suppose use of venv would become the norm, right?

@asottile
Copy link
Member

the other way, use of virtualenv would return to the only way now that it creates environments identical to venv

ssbarnea added a commit to ssbarnea/pre-commit that referenced this issue Mar 19, 2020
Avoids regression pypa/virtualenv#1740
from latest version of virtualenv.

Fixes: pre-commit#1370
@gaborbernat
Copy link

That error makes no sense if you're actually using virtualenv 20.0.10 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants