Pre-commit: vscode doesn't respect virtual environment

Created on 26 Jul 2019  路  4Comments  路  Source: pre-commit/pre-commit

Apologies if this is the wrong place for this, but I thought I might just be missing something that is already possible

Using the following config:

repos:
-   repo: https://github.com/ambv/black
    rev: stable
    hooks:
    - id: black
      name: Format python with black
      language_version: python3.7
-   repo: local
    hooks:
      - id: pytest
        name: Check pytest unit tests pass
        entry: pipenv run pytest
        pass_filenames: false
        language: python
        types: [python]

I can successfully run the commit for a build I know is passing via the command line as long as I am in a venv/virtual environment in that terminal

However, in using VSCode and clicking the commit _button_ I get errors specifically relating to using the _system_ install of python 3.7 which don't have my dependencies for testing installed on them. e.g. 'scipy not installed'

Is this something I've done wrong, something that isn't supported or something that vscode hasn't respected in the button?

question

All 4 comments

That config looks line beyond using a mutable ref stable

It's a little weird to run pytest or pipenv as part of your commit as they're pretty slow (and generally you want fast checks) but there's nothing that should prevent that from working

I suspect the bug is with either pipenv or your system setup since everything looks correct

You haven't really given a set of reproduction steps so I can't really help you. You also haven't given an error message either beyond "I get errors" which isn't helpful.

You probably have multiple pipenv executables on the PATH as well which is probably complicating things?

I'll need more information and for you to do some debugging

actually, looks like pipenv just is bad: https://github.com/pypa/pipenv/issues/2093

you'll need to run the install it seems

Agreed with:

actually, looks like pipenv just is bad: pypa/pipenv#2093

you'll need to run the install it seems

sorry for the poor repro, if I have another issue I'll bare that in mind.

no problem! thanks for the issue 馃帀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jacobseiler picture jacobseiler  路  4Comments

geekobi picture geekobi  路  3Comments

ymyke picture ymyke  路  4Comments

AdrienLemaire picture AdrienLemaire  路  4Comments

zmitchell picture zmitchell  路  3Comments