It is safer to pylint on Python 3 than Python 2#5727
It is safer to pylint on Python 3 than Python 2#5727cclauss wants to merge 1 commit intocertbot:masterfrom
Conversation
There was a problem hiding this comment.
Hey @cclauss, it would be absolutely fantastic if you could work on getting our pylint tests running in python 3! It's going to take some work though, because they don't currently pass when run with python 3.
Here's what's up: changing .travis.yml has travis set up a virtual env with the python specified (what you just changed to 3.6). But our tox.ini file specifies which python to actually run the tests with. That's currently set to python2.7, and should be changed to python3 to get it to actually use a version of python3 to run tests (it will be 3.6 in travis as specified, and whatever version of 3 people have locally when run not on travis).
The lint tests should work with any version of python 3 we support. Not sure about others, but they're definitely failing on python3.5.
Based on my own brief investigation, there's a bug in the version of pylint we use that makes it fail on some set of versions of python including 3.5. This could be fixed by upgrading pylint, but it's currently pinned to an older version because of reasoning you can find here: #289
I would love it if you could investigate this issue so we could resolve it properly, but if it's more work than you thought you'd be getting into let me know and I'll close the PR. Thanks!
|
The really strange case of python3 -m pylint import_os.py... $ git clone https://github.com/certbot/certbot
$ python3 -m pylint import_os.py
$ cp import_os.py ..
Conclusion: There is not a problem with your Python files, there is a problem with your error reporting system. If you try the same trick with import_sys.py things work so there is really something about "os" like perhaps there is a file named os.py lurking around somewhere or something. |
ad297dd to
f7b1d1a
Compare
|
@ohemorange This is ready for your review. There were several head scratchers in this one...
|
bc0aaf6 to
85ac3af
Compare
There was a problem hiding this comment.
Nice sleuthing, cclauss! Thanks for investigating this.
Looks like with later versions of things, we can go ahead and remove linter_plugin.py entirely by deleting that file and changing load-plugins=linter_plugin to load-plugins= in .pylintrc, and removing include linter_plugin.py from MANIFEST.in.
Since we rely on clean lint results for new code, I'm not comfortable merging a change into master that allows lint to fail. How do you feel about attacking the (quite lengthy but probably straightforward) list of lint failures that now show up in travis? Those can be done in separate PRs, and we can merge this PR (minus allow_failures) once we're back to a clean lint.
32a0220 to
aca4bf5
Compare
Not really. Pylint dirt is currently being swept under the rug. This PR demonstrates that for a while now Pylint has been running improperly both locally or on Travis because of linter_plugin.py. Once that is fixed, then Pylint errors are properly reported. The PR has now reverted to running Pylint on Python 2 and the repo currently contains 90+ Python files that generate Pylint errors. I am not inclined to fix all those files but it might make a nice set of tasks for first time contributors. When linter_plugin.py is deleted then the apache_compat and nginx_compat test runs fail. So linter_plugin.py is fixed to be valid Python and the cls.slots() bit commented out. .pylintrc is modified to no longer load the plugin. |
ohemorange
left a comment
There was a problem hiding this comment.
Sounds like you might not have the time to clean the lint errors. We have a hackathon coming up, so maybe we can address many of those issues and get the new way of doing things merged afterwards. Thanks again for your hard work here!
| # continue, but tox return code will reflect previous error | ||
| commands = | ||
| {[base]install_packages} | ||
| pip install --upgrade astroid pylint # required! |
There was a problem hiding this comment.
This shouldn't actually be required; developers might just have to remove and reinstall the venv.
There was a problem hiding this comment.
Try taking it out and see what breaks.
There was a problem hiding this comment.
tools/dev_constraints.txt should also be updated
Verify no conficts when working on old PR certbot#5727
|
@ohemorange, are you happy with this PR besides fixing the new linting failures? |
|
@bmw no, there's still an unaddressed review comment that I'd like to see cleared up. |
|
OK. The fix here is to remove the line commented on at #5727 (comment) and update the pinned versions in @sydneyli, perhaps @jepayne1138 can do this in #6008? |
|
Closing this in favor of #6008. @cclauss if you can make the change described at #5727 (comment), then we'll reopen to finish it up here. Thanks for all the great work you've done so far! |
Syntax Errors will be caught by pylint running on Python 3 but not when running on Python 2:
etc...