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

Add support for Python 3.12 #2219

Merged
merged 19 commits into from
Jun 27, 2023
Merged

Conversation

jacobtylerwalls
Copy link
Member

Type of Changes

Type
✨ New feature
🔨 Refactoring

Description

I suggest reviewing by commit to see the messages. (Let's rebase & merge.)

The major new feature (closes #2201): add TypeVar and TypeAlias nodes.

The others are small adjustments for python implementation details that changed in 3.12.

pyproject.toml Outdated Show resolved Hide resolved
@Pierre-Sassoulas
Copy link
Member

Amazing work !!

tests/test_raw_building.py Show resolved Hide resolved
tests/brain/test_qt.py Outdated Show resolved Hide resolved
astroid/rebuilder.py Show resolved Hide resolved
astroid/nodes/scoped_nodes/scoped_nodes.py Outdated Show resolved Hide resolved
astroid/nodes/scoped_nodes/scoped_nodes.py Outdated Show resolved Hide resolved
astroid/nodes/scoped_nodes/scoped_nodes.py Outdated Show resolved Hide resolved
@jacobtylerwalls
Copy link
Member Author

Next: assess Windows failure.

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.

Left some quick comments. Will be gone this weekend so probably won't have time to review (sorry!)

astroid/nodes/node_classes.py Outdated Show resolved Hide resolved
astroid/nodes/scoped_nodes/scoped_nodes.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 22, 2023

Codecov Report

Merging #2219 (1a72b59) into main (842548d) will increase coverage by 0.12%.
The diff coverage is 98.94%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2219      +/-   ##
==========================================
+ Coverage   92.80%   92.92%   +0.12%     
==========================================
  Files          94       95       +1     
  Lines       10840    10918      +78     
==========================================
+ Hits        10060    10146      +86     
+ Misses        780      772       -8     
Flag Coverage Δ
linux 92.73% <98.94%> (+0.17%) ⬆️
pypy 91.06% <70.52%> (+2.99%) ⬆️
windows 92.49% <98.94%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
astroid/nodes/__init__.py 100.00% <ø> (ø)
astroid/nodes/scoped_nodes/scoped_nodes.py 92.65% <93.33%> (+0.02%) ⬆️
astroid/brain/brain_datetime.py 100.00% <100.00%> (ø)
astroid/brain/brain_typing.py 86.66% <100.00%> (+0.55%) ⬆️
astroid/const.py 100.00% <100.00%> (ø)
astroid/inference.py 94.61% <100.00%> (+0.03%) ⬆️
astroid/nodes/as_string.py 97.01% <100.00%> (+0.06%) ⬆️
astroid/nodes/node_classes.py 95.55% <100.00%> (+0.29%) ⬆️
astroid/rebuilder.py 98.31% <100.00%> (+0.05%) ⬆️

... and 4 files with indirect coverage changes

@jacobtylerwalls
Copy link
Member Author

I'll squash the fixups now. Doesn't sound like anybody has pulled down the branch locally. Should be easier for the next person to review.

timedelta was optimized in Python 3.12. Use a class from
difflib to maintain the sense of the original test.
A C-accelerator was introduced for the typing module in
Python 3.12 (see python/cpython#103764).

Because a pure python source is no longer available, now we stub
out the missing classes and provide some __class_getitem__
methods to allow subscripting like Type[int].

This may mean when 3.12 is the minimum, we can remove older
brain features like infer_typing_alias().
The way ByteString was deprecated altered its mro(),
breaking the way these tests located ABCMeta as a
metaclass ancestor.
@jacobtylerwalls
Copy link
Member Author

Rebasing so that Coverage will pass (it's comparing against an older commit on main).

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.

Lots of work here, this is great ! I think we can ignore the one line that is not covered as it wasn't covered before either.

@jacobtylerwalls
Copy link
Member Author

(Weirdly, it's reporting that the docstring isn't covered.)

@jacobtylerwalls jacobtylerwalls merged commit fef38f2 into pylint-dev:main Jun 27, 2023
@jacobtylerwalls
Copy link
Member Author

Thanks for the reviews!

If we cut an astroid alpha with this soon, I can get started on 3.12 compatibility for pylint.

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

Successfully merging this pull request may close these issues.

Implement new nodes for PEP 695: Type Parameter Syntax
3 participants