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

Drop support for Python 3.8 #9774

Merged
merged 14 commits into from
Jul 9, 2024
Merged

Drop support for Python 3.8 #9774

merged 14 commits into from
Jul 9, 2024

Conversation

jacobtylerwalls
Copy link
Member

Remove support for launching pylint with Python 3.8.
Code that supports Python 3.8 can still be linted with the --py-version=3.8 setting.

Type of Changes

Type
βœ“ πŸ”¨ Refactoring

@jacobtylerwalls jacobtylerwalls added the Maintenance Discussion or action around maintaining pylint or the dev workflow label Jul 7, 2024
@jacobtylerwalls jacobtylerwalls added this to the 3.3.0 milestone Jul 7, 2024
Copy link

codecov bot commented Jul 7, 2024

Codecov Report

All modified and coverable lines are covered by tests βœ…

Project coverage is 95.81%. Comparing base (05a1950) to head (4b45192).
Report is 138 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #9774      +/-   ##
==========================================
- Coverage   95.84%   95.81%   -0.04%     
==========================================
  Files         174      174              
  Lines       18878    18860      -18     
==========================================
- Hits        18094    18070      -24     
- Misses        784      790       +6     
Files with missing lines Coverage Ξ”
pylint/checkers/base/name_checker/checker.py 98.63% <100.00%> (ΓΈ)
pylint/checkers/imports.py 94.86% <100.00%> (ΓΈ)
pylint/checkers/method_args.py 100.00% <ΓΈ> (ΓΈ)
pylint/checkers/nested_min_max.py 100.00% <100.00%> (ΓΈ)
pylint/checkers/stdlib.py 96.25% <100.00%> (-0.69%) ⬇️
pylint/checkers/symilar.py 96.30% <100.00%> (ΓΈ)
pylint/checkers/utils.py 96.06% <100.00%> (-0.10%) ⬇️
pylint/checkers/variables.py 97.16% <100.00%> (-0.15%) ⬇️
pylint/config/argument.py 100.00% <100.00%> (ΓΈ)
pylint/config/config_file_parser.py 100.00% <100.00%> (ΓΈ)
... and 21 more

... and 1 file with indirect coverage changes

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really great. I'm not sure we should remove the functional tests for py38/py39 (unless it's actual max_pyver=3.8) ?

@@ -41,7 +41,6 @@ class MethodArgsChecker(BaseChecker):
"positional-only-arguments-expected",
"Emitted when positional-only arguments have been passed as keyword arguments. "
"Remove the keywords for the affected arguments in the function call.",
{"minversion": (3, 8)},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we replace this with a py-version check ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, but if my library supports 3.7 - 3.12, and I'm using a 3.8 function with positional-only arguments in the wrong manner, wouldn't I rather continue to see the message even if --py-version=3.7, because I certainly have bigger problems anyway if I'm using a 3.8+ function when I supposedly support 3.7?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought --py-version was most helpful for ensuring we silence suggestion-style messages that don't make sense on lower versions, like consider-using-f-string, but here we have a message that won't ever get raised on a lower version anyway, so I don't think we need to add a --py-version workaround for it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Jacob's second comment. I don't think it will add much benefit to spend the time to add support for that edge case. Removing this line is fine.

pylint/message/message_definition_store.py Show resolved Hide resolved
@jacobtylerwalls
Copy link
Member Author

I'm not sure we should remove the functional tests for py38/py39 (unless it's actual max_pyver=3.8) ?

I may not be following exactly, but it's worth remembering this: max_pyver=3.9 means run on 3.8 and below. I'd rather that be what happens when you put max_pyver=3.8, but it is what it is 🀷 . So anything with max_pyver=3.9 won't run when 3.9 is the minimum version and can be deleted, is my understanding.

@Pierre-Sassoulas
Copy link
Member

I may not be following exactly, but it's worth remembering this: max_pyver=3.9 means run on 3.8 and below. I'd rather that be what happens when you put max_pyver=3.8, but it is what it is 🀷 .

Yeah, didn't have that in mind either πŸ˜… I'm feeling like making a breaking change, it's likely that (mainly) only us pylint maintainers use that atm. I never saw a plugin with functional tests in the wild. I'll re-review with that in mind later.

Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job!

Just one comment from me.

There are some functional tests where it would have been nice to convert them to be messages when py-version==3.7 but that is a lot of work and I don't think is something we should focus our limited time on.

.github/workflows/tests.yaml Outdated Show resolved Hide resolved
@@ -41,7 +41,6 @@ class MethodArgsChecker(BaseChecker):
"positional-only-arguments-expected",
"Emitted when positional-only arguments have been passed as keyword arguments. "
"Remove the keywords for the affected arguments in the function call.",
{"minversion": (3, 8)},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Jacob's second comment. I don't think it will add much benefit to spend the time to add support for that edge case. Removing this line is fine.

pylint/testutils/output_line.py Outdated Show resolved Hide resolved
DanielNoord
DanielNoord previously approved these changes Jul 8, 2024
Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸš€

@jacobtylerwalls
Copy link
Member Author

Last push resolves merge conflict with #9777

DanielNoord
DanielNoord previously approved these changes Jul 8, 2024
@jacobtylerwalls
Copy link
Member Author

Latest push to resolve merge conflict

@jacobtylerwalls jacobtylerwalls merged commit 52fe657 into main Jul 9, 2024
32 of 40 checks passed
@jacobtylerwalls jacobtylerwalls deleted the drop-py38 branch July 9, 2024 11:35
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I wasn't able to review faster.

I feel like we're loosing a lot of valuable interpreter specific knowledge that could be integrated in py-version when we remove functional tests that ran only for EOL interpreters without looking in detail at what's happening. We already did that in the past but I think it's makingpy-version kinda weak and 3.8 is easier to support than 3.7 because the ast's column/line is so much closer with other interpreters. I don't know if you looked at each test in detail and cleaned up the copy pastes or simple removed the one that ran only on EOL interpreters, Jacob ? There's a lot to review there I still didn't do it, but I feel like, for example, the carefully crafted tests about typing in python 3.8 from g/generic_alias/generic_alias_collections_py37.py brought a lot of value and the removal is going to hurt when someone open issues postfaced "I use py-version 3.8, pylint should not suggest impossible things for my interpreter, it was working fine in old version".

@@ -61,7 +61,6 @@ test runner. The following options are currently supported:

- "min_pyver": Minimal python version required to run the test
- "max_pyver": Python version from which the test won't be run. If the last supported version is 3.9 this setting should be set to 3.10.
- "min_pyver_end_position": Minimal python version required to check the end_line and end_column attributes of the message
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we should remove this, sometime there's a new column/line in a new version. In particular when a bug is fixed or a nodes end is adjusted (in cpython). When this is the case we choose the newer version. This is still true in new interpreters. (Introduced when dealing with 3.9 only column change afair ?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation, will revert.

Comment on lines -84 to -86
self._linter._arg_parser.add_argument(
"--min_pyver_end_position", type=parse_python_version, default=(3, 8)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default was 3.8 and should become None

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this as 3.8 for now because it's strongly typed as a tuple.

@jacobtylerwalls
Copy link
Member Author

jacobtylerwalls commented Jul 9, 2024

Thanks for the review Pierre, and sorry for rushing you.

I don't know if you looked at each test in detail and cleaned up the copy pastes or simple removed the one that ran only on EOL interpreters, Jacob ?

I just removed tests that ran only on EOL interpreters. If there are tests showing functionality that we can capture with py-version, I'm more than happy to make a new issue and itemize each one showing whether it's been investigated. It feels more "useful and optional" than dropping python 3.8, which I think we needed to do this summer, and I had a day to do it.

There are some functional tests where it would have been nice to convert them to be messages when py-version==3.7 but that is a lot of work and I don't think is something we should focus our limited time on.

This is where I was at too, but as I mentioned above I'm happy to stub out an issue to investigate. I have separate commits in this PR to make this easier. However...

for example, the carefully crafted tests about typing in python 3.8 from g/generic_alias/generic_alias_collections_py37.py brought a lot of value

I'm not sure I see what we can salvage here. How are we going to know to raise unsubscriptable-object when py-version is 3.8 or below? Won't that require astroid changes? We've never done that to my knowledge, but my imagination might be a little weak here :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Discussion or action around maintaining pylint or the dev workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants