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

Support Python 3.12 #1956

Merged
merged 5 commits into from
Sep 17, 2023
Merged

Support Python 3.12 #1956

merged 5 commits into from
Sep 17, 2023

Conversation

PeterJCLaw
Copy link
Collaborator

Fixes #1955

@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2023

Codecov Report

Patch coverage is 100.00% of modified lines.

❗ Current head e24674f differs from pull request most recent head a60fdba. Consider uploading reports for the commit a60fdba to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files Changed Coverage
jedi/api/environment.py 100.00%
jedi/inference/__init__.py 100.00%

📢 Thoughts on this report? Let us know!.

@PeterJCLaw PeterJCLaw force-pushed the python-3.12 branch 2 times, most recently from a33f5c7 to 8ca5785 Compare September 16, 2023 20:38
It's not completely clear why this was pinned originally, though
at the time Jedi supported Python 2.7 as well as 3.5-3.8, so that
may have had something to do with it.

Removing this pin now seems to work in CI and unblocks some issues
we're seeing around Python 3.12 (specifically that Django<3.1
implicitly relies on distutils, which is no longer available by
default, and possibly other issues).
@davidhalter
Copy link
Owner

I think the test_compiled_signature test is easily fixable, you can just change the line from

('next', 'next(iterator, default=None, /)', ['iterator', 'default'], ge, (3, 6)),

to

('next', 'next(iterator, default=None, /)', ['iterator', 'default'], lt, (3, 12)),
('next', 'next(iterator, default=None, /)', [], ge, (3, 12)),

I'm not 100% sure this is the correct solution, because I haven't tried it. But I feel like you get what I want to do here.


The docstring test about next is a test that I would probably just skip if the environment doesn't match the currrent version (or InterpreterEnvironment). It's probably as simple as adding an environment fixture and then checking environment.version_info == sys.version_info. Do you understand what I think here?

@@ -17,7 +17,7 @@

_VersionInfo = namedtuple('VersionInfo', 'major minor micro') # type: ignore[name-match]

_SUPPORTED_PYTHONS = ['3.11', '3.10', '3.9', '3.8', '3.7', '3.6']
_SUPPORTED_PYTHONS = ['3.12', '3.11', '3.10', '3.9', '3.8', '3.7', '3.6']
Copy link
Owner

@davidhalter davidhalter Sep 17, 2023

Choose a reason for hiding this comment

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

Just FYI I'm still thinking about allowing users to use newer versions than 3.12, even if they are not officially supported by us yet. I feel like it's a bit strange, that CPython devs are not able to use a 3.13 Jedi at the moment, even though that is mostly the same as 3.12. But that's probably for another pull request.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed.

For Pillow, we let people install for whatever version and platform they want.

But because of the C extensions, you're best of using a prebuilt wheel for Windows, as it's likely to fail for most people who don't have a compiler set up.

So for Windows + 3.13+ we print a warning instead: https://github.com/python-pillow/Pillow/blob/c556c5f2412658a80fceb8f8533d49ba70b319e5/setup.py#L42-L53

And there will be an alpha release next month for 3.13 (PEP 719), it's good to let people test early, it can help find bugs in CPython nice and early.

The signature of the builtin isn't actually changing in Python 3.12,
however its documentation has changed.
@PeterJCLaw
Copy link
Collaborator Author

Thanks, have adapted for the next signature docs changing in a60fdba.

@PeterJCLaw PeterJCLaw marked this pull request as ready for review September 17, 2023 17:48
@davidhalter
Copy link
Owner

Thanks a lot for taking care of this! I really appreciate this effort especially, because it involves a lot of annoying things.

@davidhalter davidhalter merged commit 0770372 into davidhalter:master Sep 17, 2023
114 checks passed
@davidhalter
Copy link
Owner

What do you think: Should I release a new version?

@PeterJCLaw PeterJCLaw deleted the python-3.12 branch September 17, 2023 19:47
@PeterJCLaw
Copy link
Collaborator Author

Yeah, a new version with this support would be good IMO. Can probably be 0.19.1 as there's nothing breaking?

@davidhalter
Copy link
Owner

Released.

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

Successfully merging this pull request may close these issues.

Test failures with Python 3.12
4 participants