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
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04, windows-2019]
python-version: ["3.11", "3.10", "3.9", "3.8", "3.7", "3.6"]
environment: ['3.8', '3.11', '3.10', '3.9', '3.7', '3.6', 'interpreter']
python-version: ["3.12", "3.11", "3.10", "3.9", "3.8", "3.7", "3.6"]
environment: ['3.8', '3.12', '3.11', '3.10', '3.9', '3.7', '3.6', 'interpreter']
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -19,10 +19,12 @@ jobs:
if: ${{ matrix.environment != 'interpreter' }}
with:
python-version: ${{ matrix.environment }}
allow-prereleases: true

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Install dependencies
run: 'pip install .[testing]'
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Changelog
Unreleased
++++++++++

- Python 3.12 support

0.19.0 (2023-07-29)
+++++++++++++++++++

Expand Down
2 changes: 1 addition & 1 deletion jedi/api/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

_SAFE_PATHS = ['/usr/bin', '/usr/local/bin']
_CONDA_VAR = 'CONDA_PREFIX'
_CURRENT_VERSION = '%s.%s' % (sys.version_info.major, sys.version_info.minor)
Expand Down
2 changes: 1 addition & 1 deletion jedi/inference/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(self, project, environment=None, script_path=None):
self.compiled_subprocess = environment.get_inference_state_subprocess(self)
self.grammar = environment.get_grammar()

self.latest_grammar = parso.load_grammar(version='3.11')
self.latest_grammar = parso.load_grammar(version='3.12')
self.memoize_cache = {} # for memoize decorators
self.module_cache = imports.ModuleCache() # does the job of `sys.modules`.
self.stub_module_cache = {} # Dict[Tuple[str, ...], Optional[ModuleValue]]
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
long_description=readme,
packages=find_packages(exclude=['test', 'test.*']),
python_requires='>=3.6',
# Python 3.11 grammar is added to parso in 0.8.3
# Python 3.11 & 3.12 grammars are added to parso in 0.8.3
install_requires=['parso>=0.8.3,<0.9.0'],
extras_require={
'testing': [
Expand All @@ -41,7 +41,7 @@
'docopt',
# coloroma for colored debug output
'colorama',
'Django<3.1', # For now pin this.
'Django',
'attrs',
],
'qa': [
Expand Down Expand Up @@ -97,6 +97,7 @@
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Text Editors :: Integrated Development Environments (IDE)',
'Topic :: Utilities',
Expand Down
2 changes: 1 addition & 1 deletion test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_import(self):
if all(not x.startswith('from os import ' + s)
for s in ['_', 'O_', 'EX_', 'MFD_', 'SF_', 'ST_',
'CLD_', 'POSIX_SPAWN_', 'P_', 'RWF_',
'SCHED_'])
'CLONE_', 'SCHED_'])
}
# There are quite a few differences, because both Windows and Linux
# (posix and nt) libraries are included.
Expand Down
Loading