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 #2175

Merged
merged 7 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
---
name: Test

"on":
on:
push:
pull_request:

permissions:
contents: read

env:
FORCE_COLOR: 1

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
Expand Down
2 changes: 1 addition & 1 deletion isort/stdlibs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from . import all as _all
from . import py2, py3, py27, py36, py37, py38, py39, py310, py311
from . import py2, py3, py27, py36, py37, py38, py39, py310, py311, py312
12 changes: 10 additions & 2 deletions isort/stdlibs/py3.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
from . import py36, py37, py38, py39, py310, py311
from . import py36, py37, py38, py39, py310, py311, py312

stdlib = py36.stdlib | py37.stdlib | py38.stdlib | py39.stdlib | py310.stdlib | py311.stdlib
stdlib = (
py36.stdlib
| py37.stdlib
| py38.stdlib
| py39.stdlib
| py310.stdlib
| py311.stdlib
| py312.stdlib
)
3 changes: 3 additions & 0 deletions isort/stdlibs/py311.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
stdlib = {
"_ast",
"_thread",
"_tkinter",
"abc",
"aifc",
"argparse",
Expand Down Expand Up @@ -153,6 +154,7 @@
"shutil",
"signal",
"site",
"sitecustomize",
"smtpd",
"smtplib",
"sndhdr",
Expand Down Expand Up @@ -201,6 +203,7 @@
"unicodedata",
"unittest",
"urllib",
"usercustomize",
"uu",
"uuid",
"venv",
Expand Down
220 changes: 220 additions & 0 deletions isort/stdlibs/py312.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
"""
File contains the standard library of Python 3.12.

DO NOT EDIT. If the standard library changes, a new list should be created
using the mkstdlibs.py script.
"""

stdlib = {
"_ast",
"_thread",
"_tkinter",
"abc",
"aifc",
"argparse",
"array",
"ast",
"asyncio",
"atexit",
"audioop",
"base64",
"bdb",
"binascii",
"bisect",
"builtins",
"bz2",
"cProfile",
"calendar",
"cgi",
"cgitb",
"chunk",
"cmath",
"cmd",
"code",
"codecs",
"codeop",
"collections",
"colorsys",
"compileall",
"concurrent",
"configparser",
"contextlib",
"contextvars",
"copy",
"copyreg",
"crypt",
"csv",
"ctypes",
"curses",
"dataclasses",
"datetime",
"dbm",
"decimal",
"difflib",
"dis",
"doctest",
"email",
"encodings",
"ensurepip",
"enum",
"errno",
"faulthandler",
"fcntl",
"filecmp",
"fileinput",
"fnmatch",
"fractions",
"ftplib",
"functools",
"gc",
"getopt",
"getpass",
"gettext",
"glob",
"graphlib",
"grp",
"gzip",
"hashlib",
"heapq",
"hmac",
"html",
"http",
"idlelib",
"imaplib",
"imghdr",
"importlib",
"inspect",
"io",
"ipaddress",
"itertools",
"json",
"keyword",
"lib2to3",
"linecache",
"locale",
"logging",
"lzma",
"mailbox",
"mailcap",
"marshal",
"math",
"mimetypes",
"mmap",
"modulefinder",
"msilib",
"msvcrt",
"multiprocessing",
"netrc",
"nis",
"nntplib",
"ntpath",
"numbers",
"operator",
"optparse",
"os",
"ossaudiodev",
"pathlib",
"pdb",
"pickle",
"pickletools",
"pipes",
"pkgutil",
"platform",
"plistlib",
"poplib",
"posix",
"posixpath",
"pprint",
"profile",
"pstats",
"pty",
"pwd",
"py_compile",
"pyclbr",
"pydoc",
"queue",
"quopri",
"random",
"re",
"readline",
"reprlib",
"resource",
"rlcompleter",
"runpy",
"sched",
"secrets",
"select",
"selectors",
"shelve",
"shlex",
"shutil",
"signal",
"site",
"sitecustomize",
"smtplib",
"sndhdr",
"socket",
"socketserver",
"spwd",
"sqlite3",
"sre",
"sre_compile",
"sre_constants",
"sre_parse",
"ssl",
"stat",
"statistics",
"string",
"stringprep",
"struct",
"subprocess",
"sunau",
"symtable",
"sys",
"sysconfig",
"syslog",
"tabnanny",
"tarfile",
"telnetlib",
"tempfile",
"termios",
"test",
"textwrap",
"threading",
"time",
"timeit",
"tkinter",
"token",
"tokenize",
"tomllib",
"trace",
"traceback",
"tracemalloc",
"tty",
"turtle",
"turtledemo",
"types",
"typing",
"unicodedata",
"unittest",
"urllib",
"usercustomize",
"uu",
"uuid",
"venv",
"warnings",
"wave",
"weakref",
"webbrowser",
"winreg",
"winsound",
"wsgiref",
"xdrlib",
"xml",
"xmlrpc",
"zipapp",
"zipfile",
"zipimport",
"zlib",
"zoneinfo",
}
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
Expand Down
8 changes: 7 additions & 1 deletion scripts/mkstdlibs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@

URL = "https://docs.python.org/{}/objects.inv"
PATH = "isort/stdlibs/py{}.py"
VERSIONS = [("2", "7"), ("3", "6"), ("3", "7"), ("3", "8"), ("3", "9"), ("3", "10"), ("3", "11")]
VERSIONS = [
("3", "8"),
("3", "9"),
("3", "10"),
("3", "11"),
("3", "12"),
]

DOCSTRING = """
File contains the standard library of Python {}.
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_importable.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def test_importable():
import isort.stdlibs.py39
import isort.stdlibs.py310
import isort.stdlibs.py311
import isort.stdlibs.py312
import isort.utils
import isort.wrap
import isort.wrap_modes
Expand Down
Loading