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鈥檚 virtualenv, and use it (pipenv run flake8 .) instead.

Maybe this command can be tweaked to detect whether Flake8 is available in the project鈥檚 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

konstin picture konstin  路  3Comments

jacebrowning picture jacebrowning  路  3Comments

xi picture xi  路  3Comments

marc-fez picture marc-fez  路  3Comments

jerzyk picture jerzyk  路  3Comments