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

pylint 1.9.5 is broken because of isort 5 #3971

Closed
abitrolly opened this issue Dec 7, 2020 · 7 comments
Closed

pylint 1.9.5 is broken because of isort 5 #3971

abitrolly opened this issue Dec 7, 2020 · 7 comments

Comments

@abitrolly
Copy link

pylint is used by this project that is #not-so-trivial to port to Python 3 yet.

Finished processing dependencies for pylint==1.9.5
Traceback (most recent call last):
  File "build/bin/pylint", line 11, in <module>
    load_entry_point('pylint==1.9.5', 'console_scripts', 'pylint')()
...
  File "/Users/travis/gopath/src/github.com/grumpyhome/grumpy/grumpy-runtime-src/build/lib/python2.7/site-packages/pylint-1.9.5-py2.7.egg/pylint/utils.py", line 1033, in register_plugins
    module = modutils.load_module_from_file(join(directory, filename))
  File "/Users/travis/gopath/src/github.com/grumpyhome/grumpy/grumpy-runtime-src/build/lib/python2.7/site-packages/astroid-1.6.6-py2.7.egg/astroid/modutils.py", line 272, in load_module_from_file
    return load_module_from_modpath(modpath, path, use_sys)
  File "/Users/travis/gopath/src/github.com/grumpyhome/grumpy/grumpy-runtime-src/build/lib/python2.7/site-packages/astroid-1.6.6-py2.7.egg/astroid/modutils.py", line 233, in load_module_from_modpath
    module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
  File "/Users/travis/gopath/src/github.com/grumpyhome/grumpy/grumpy-runtime-src/build/lib/python2.7/site-packages/pylint-1.9.5-py2.7.egg/pylint/checkers/imports.py", line 40, in <module>
    import isort
  File "/Users/travis/gopath/src/github.com/grumpyhome/grumpy/grumpy-runtime-src/build/lib/python2.7/site-packages/isort-5.6.4-py2.7.egg/isort/__init__.py", line 2, in <module>
    from . import settings
  File "/Users/travis/gopath/src/github.com/grumpyhome/grumpy/grumpy-runtime-src/build/lib/python2.7/site-packages/isort-5.6.4-py2.7.egg/isort/settings.py", line 36
    FILE_SKIP_COMMENTS: Tuple[str, ...] = (
                      ^
SyntaxError: invalid syntax

Expected behavior

1.9.x to still work for Python 2.

@dbaty
Copy link
Contributor

dbaty commented Dec 8, 2020

pylint 1.9.5 had a relatively loose requirement on isort: isort >= 4.2.5. It was fine when 1.9.5 was released.

But now that pulls isort 5, which is not compatible with Python 2 anymore. (That is, it can read Python 2 code, but you need to run isort with Python 3.6+, cf. its documentation for further details.)

In your case, I would suggest adding isort<5 before pylint==1.9.5 in your project requirements. That should get you isort 4, which is compatible with Python 2.

If that's all right, you may close this issue.

@abitrolly
Copy link
Author

@dbaty I expect there are many legacy projects, where porting efforts would benefit from having working pylint out of the box. If it is possible to release a mainenance update for 1.9.x, I'd rather wait for that.

@PCManticore
Copy link
Contributor

My opinion is that the best course of action here is to pin the isort version in 1.9.6. This won't get you isort 5 but at least pylint would still be able to work. We won't port the isort 4+5 support that was added in pylint 2.6 though.

@abitrolly
Copy link
Author

Pinning isort in 1.9.6 seems fine with me.

@Pierre-Sassoulas
Copy link
Member

Meanwhile, if you encounter the problem in your CI you can pin isort yourself. Pylint has isort >= 4.2.5 in 1.9.5, if you add isort <5 in your own requirements, 1.9.5 will work again before we release 1.9.6 (@PCManticore I could do it, but I would need to have maintainer right on pypi.).

@abitrolly
Copy link
Author

I'll be waiting for the new release. Thanks for the hint, though.

@jacobtylerwalls
Copy link
Member

This issue is useful as a google-indexed reference for folks needing to manage their dependencies on legacy projects.

Although it was worthy of discussion at the time, 1.9.5 is almost three years old, and I know of no plans to maintain it here (and I wouldn't be in favor of doing so). I hope that makes sense.

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

No branches or pull requests

5 participants