-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix issues with Python 3.6.0 #4446
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you this look dandy 😄 !
It seems like the tests for python 3.8 3.9 are flaky. We also encountered the problem in #4442, so definitely not a problem with what you did.
Thanks! |
The tests are now fixed. A rebase should do it |
2465d32
to
b731c73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a commit with some minor style changes directly to your branch. It seems though, that there is a merge conflict with ChangeLog
.
tox.ini
Outdated
-r {toxinidir}/requirements_test.txt | ||
-r {toxinidir}/requirements_test_min.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like this change. requirements_test.txt
also includes optional dependencies for pytest that are not tested without them. Does tox
fail completely if it can't install all dependencies, even if only python_requires
doesn't match?
If that is the case, I would like to suggest to remove py36
from the envlist
. It will still be tested through Github actions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, good point. Yes, tox
fails completely. Removing py36
from the envlist
doesn’t really solve the goal either, which is to test that version locally, and would just make things harder on other contributors running with 3.6.2+.
I’ll take another look at these and ponder on it a bit. Maybe move the pytest extensions to _min or otherwise refactor the way things are broken down? Or add python_requires
markers where needed (although that feels a bit like polluting the code). Or just drop this part of the change, especially if it’s not worth adding CI coverage for 3.6.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python_requires
would work. As I understand it, we just need to make sure black isn't installed for 3.6.0
, am I right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will work on the marker way. pre-commit is 3.6.2+ too, might be one or two others too. Will find them in testing 😀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just though about something else. This might work even better: https://tox.readthedocs.io/en/latest/config.html#generating-environments-conditional-settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, missed until now. The trick with the conditional factors is that they have to appear in the env name, it couldn't be automatic based on the python_full_version
. Closest we'd get would be something like tox -e py36-min
that installed requirements_test_min.txt
instead of requirements_test.txt
. The python_full_version
markers would let the pytest extensions run on 3.6.0 if we needed them to.
Turns out there were only three packages needing markers... let me know what you think. Happy to keep iterating on this.
Thanks for the heads up. The changes look good to me, will keep them when I rebase again. |
The requirements_test.txt includes black, pre-commit, and pyupgrade which are not compatible with Python 3.6.0. Add python_full_version markers so that `tox -e py36` works with 3.6.0.
typing.Counter was added in Python 3.6.1. In the strings checker, guard the import with TYPE_CHECKING and use a type annotation comment to fix usage with Python 3.6.0.
typing.NoReturn was introduced in Python 3.6.2. Move the tests for issue pylint-dev#4122 to a separate file and skip when Python is too old. Co-authored-by: Marc Mueller <[email protected]>
5fed063
to
d6e5e89
Compare
@@ -2,7 +2,7 @@ | |||
-r requirements_test_min.txt | |||
coveralls~=3.0 | |||
coverage~=5.5 | |||
pre-commit~=2.12 | |||
pre-commit~=2.12;python_full_version>="3.6.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use just python_version
? Same in requirements_test_pre_commit.txt
.
https://www.python.org/dev/peps/pep-0496/#version-numbers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
platform.python_version()
is a dotted string, so according to that PEP python_version
doesn’t include the micro part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, didn't know that
Thanks! |
@pkolbus Thank you for doing the work! |
Steps
doc/whatsnew/<current release.rst>
.Description
This PR fixes compatibility with Python 3.6.0, mainly due to
typing
:typing.Counter
is added in Python 3.6.1, so make the import conditional on TYPE_CHECKING.typing.NoReturn
is added in Python 3.6.2, split the inconsistent_returns tests that need this to it's own file.black
,pre-commit
andpyupgrade
require Python 3.6.1 (or later), addpython_full_version
markers sotox -e py36
worksType of Changes
Related Issue
Closes #4412