diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c5438df..8c128230 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: diff --git a/isort/stdlibs/__init__.py b/isort/stdlibs/__init__.py index 3394a7ed..fc9dcbb8 100644 --- a/isort/stdlibs/__init__.py +++ b/isort/stdlibs/__init__.py @@ -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 diff --git a/isort/stdlibs/py3.py b/isort/stdlibs/py3.py index 98825438..c94e9797 100644 --- a/isort/stdlibs/py3.py +++ b/isort/stdlibs/py3.py @@ -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 +) diff --git a/isort/stdlibs/py311.py b/isort/stdlibs/py311.py index 6fa42e99..8f1d6e1f 100644 --- a/isort/stdlibs/py311.py +++ b/isort/stdlibs/py311.py @@ -8,6 +8,7 @@ stdlib = { "_ast", "_thread", + "_tkinter", "abc", "aifc", "argparse", @@ -153,6 +154,7 @@ "shutil", "signal", "site", + "sitecustomize", "smtpd", "smtplib", "sndhdr", @@ -201,6 +203,7 @@ "unicodedata", "unittest", "urllib", + "usercustomize", "uu", "uuid", "venv", diff --git a/isort/stdlibs/py312.py b/isort/stdlibs/py312.py new file mode 100644 index 00000000..cedf2a2f --- /dev/null +++ b/isort/stdlibs/py312.py @@ -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", +} diff --git a/pyproject.toml b/pyproject.toml index 6b481b4c..72c19c17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/scripts/mkstdlibs.py b/scripts/mkstdlibs.py index 82c36556..9f375be2 100755 --- a/scripts/mkstdlibs.py +++ b/scripts/mkstdlibs.py @@ -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 {}. diff --git a/tests/unit/test_importable.py b/tests/unit/test_importable.py index 52db143c..617a9d99 100644 --- a/tests/unit/test_importable.py +++ b/tests/unit/test_importable.py @@ -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