Pipenv: flake8 check does not respect projects python version

Created on 17 Dec 2017  ·  8Comments  ·  Source: pypa/pipenv

pipenv check --style appears to run the syntax check depending on its own python version instead of respecting the python version specified in the projects Pipfile.

Describe your environment
  1. OS Type: Debian 9
  2. Python version: $ python3 -V: Python 3.5.3
  3. Pipenv version: $ pipenv --version: pipenv, version 9.0.1
Expected result

No errors.

Actual result
/home/user/myenv/testfile.py:2:18: E999 SyntaxError: invalid syntax
Steps to replicate

pipenv check --style testfile.py

testfile.py

bar = 'baz'
print(f'foo {bar}')

Pipfile

[[source]]
verify_ssl = true
url = "https://pypi.python.org/simple"
name = "pypi"
[requires]
python_version = "3.6"
[dev-packages]
[packages]
Type help wanted

Most helpful comment

I'd be more apt to remove the flake8 checking myself.

All 8 comments

yes, it is far from perfect.

AFAIK PyFlakes relies on the Python itself is installed in to analyse the code (with ast), and therefore is only capable of linting that exact Python version. There is really no way around this but to install a seperate Flake8 copy inside the project’s virtualenv, and use it (pipenv run flake8 .) instead.

Maybe this command can be tweaked to detect whether Flake8 is available in the project’s virtualenv, and use it if possible?

I'd be more apt to remove the flake8 checking myself.

That would be even better.

It would be great to remove the Flake8 integration. In addition to the integration not working quite right, I also find it quite odd to see Flake8 end up in my production environments via Pipenv.

So what would the desired outcome be to fix this ticket?

Should --style be removed altogether or is there a better alternative syntax checker to use instead?

Since it doesn't work properly and that doesn't seem to be an issue easily solved I'd also prefer removal, if at some point there will be a better solution that could be implemented if people agree on it, however, imo it shouldn't be left in a broken state.

This is being worked on in #1394.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jerzyk picture jerzyk  ·  3Comments

xi picture xi  ·  3Comments

jeyraof picture jeyraof  ·  3Comments

ipmb picture ipmb  ·  3Comments

bgjelstrup picture bgjelstrup  ·  3Comments