From 0164587c734892032bc252d9f666d85df74fefa4 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sat, 16 Sep 2023 18:06:35 +0300 Subject: [PATCH 1/7] Add support for Python 3.12 --- .github/workflows/integration.yml | 6 +++--- .github/workflows/labeler.yml | 4 ++-- .github/workflows/lint.yml | 6 +++--- .github/workflows/release.yml | 4 ++-- .github/workflows/test.yml | 20 ++++++++++++-------- pyproject.toml | 1 + 6 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 035dcab8..481890b0 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -16,10 +16,10 @@ jobs: python-version: ["3.11"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: pip cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/pip key: integration-pip-${{ hashFiles('**/pyproject.toml') }} @@ -27,7 +27,7 @@ jobs: integration-pip- - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 0d55db3e..86439a5e 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -11,9 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run Labeler - uses: crazy-max/ghaction-github-labeler@v4 + uses: crazy-max/ghaction-github-labeler@v5 with: skip-delete: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4856b6ed..c20df03a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,10 +16,10 @@ jobs: python-version: ["3.11"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: pip cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/pip key: lint-pip-${{ hashFiles('**/pyproject.toml') }} @@ -27,7 +27,7 @@ jobs: lint-pip- - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 69350229..e1756034 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 @@ -59,7 +59,7 @@ jobs: - name: Publish package on PyPI if: steps.check-version.outputs.tag - uses: pypa/gh-action-pypi-publish@release/v1 + uses: pypa/gh-action-pypi-publish@v1.8.10/v1 with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c5438df..9ffd5453 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,26 +1,29 @@ --- 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: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Ubuntu cache - uses: actions/cache@v2 + uses: actions/cache@v3 if: startsWith(matrix.os, 'ubuntu') with: path: ~/.cache/pip @@ -30,7 +33,7 @@ jobs: ${{ matrix.os }}-${{ matrix.python-version }}- - name: macOS cache - uses: actions/cache@v2 + uses: actions/cache@v3 if: startsWith(matrix.os, 'macOS') with: path: ~/Library/Caches/pip @@ -40,7 +43,7 @@ jobs: ${{ matrix.os }}-${{ matrix.python-version }}- - name: Windows cache - uses: actions/cache@v2 + uses: actions/cache@v3 if: startsWith(matrix.os, 'windows') with: path: c:\users\runneradmin\appdata\local\pip\cache @@ -50,9 +53,10 @@ jobs: ${{ matrix.os }}-${{ matrix.python-version }}- - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Upgrade pip run: | @@ -73,4 +77,4 @@ jobs: - name: Report Coverage if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3 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", From 2c18d82fec918064a45aa548ef18636a24be9a24 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sat, 2 Dec 2023 08:14:39 -0700 Subject: [PATCH 2/7] Downgrade GitHub Actions --- .github/workflows/integration.yml | 6 +++--- .github/workflows/labeler.yml | 4 ++-- .github/workflows/lint.yml | 6 +++--- .github/workflows/release.yml | 4 ++-- .github/workflows/test.yml | 12 ++++++------ 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 481890b0..035dcab8 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -16,10 +16,10 @@ jobs: python-version: ["3.11"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 - name: pip cache - uses: actions/cache@v3 + uses: actions/cache@v2 with: path: ~/.cache/pip key: integration-pip-${{ hashFiles('**/pyproject.toml') }} @@ -27,7 +27,7 @@ jobs: integration-pip- - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 86439a5e..0d55db3e 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -11,9 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repository - uses: actions/checkout@v4 + uses: actions/checkout@v3 - name: Run Labeler - uses: crazy-max/ghaction-github-labeler@v5 + uses: crazy-max/ghaction-github-labeler@v4 with: skip-delete: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c20df03a..4856b6ed 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,10 +16,10 @@ jobs: python-version: ["3.11"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 - name: pip cache - uses: actions/cache@v3 + uses: actions/cache@v2 with: path: ~/.cache/pip key: lint-pip-${{ hashFiles('**/pyproject.toml') }} @@ -27,7 +27,7 @@ jobs: lint-pip- - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e1756034..69350229 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repository - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: fetch-depth: 2 @@ -59,7 +59,7 @@ jobs: - name: Publish package on PyPI if: steps.check-version.outputs.tag - uses: pypa/gh-action-pypi-publish@v1.8.10/v1 + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9ffd5453..5fbb86c4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,9 +21,9 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 - name: Ubuntu cache - uses: actions/cache@v3 + uses: actions/cache@v2 if: startsWith(matrix.os, 'ubuntu') with: path: ~/.cache/pip @@ -33,7 +33,7 @@ jobs: ${{ matrix.os }}-${{ matrix.python-version }}- - name: macOS cache - uses: actions/cache@v3 + uses: actions/cache@v2 if: startsWith(matrix.os, 'macOS') with: path: ~/Library/Caches/pip @@ -43,7 +43,7 @@ jobs: ${{ matrix.os }}-${{ matrix.python-version }}- - name: Windows cache - uses: actions/cache@v3 + uses: actions/cache@v2 if: startsWith(matrix.os, 'windows') with: path: c:\users\runneradmin\appdata\local\pip\cache @@ -53,7 +53,7 @@ jobs: ${{ matrix.os }}-${{ matrix.python-version }}- - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} allow-prereleases: true @@ -77,4 +77,4 @@ jobs: - name: Report Coverage if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v1 From afa7c88771c6a0a52c1db3c426f555e5f94496d4 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 3 Dec 2023 14:00:44 -0700 Subject: [PATCH 3/7] Remove "allow-prereleases: true" --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5fbb86c4..8c128230 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,7 +56,6 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - allow-prereleases: true - name: Upgrade pip run: | From 92c827454c0def7e3f815e7f35dc29c743dde6c8 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 4 Dec 2023 14:09:01 +0200 Subject: [PATCH 4/7] Add 3.12 to mkstdlibs.py --- scripts/mkstdlibs.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/mkstdlibs.py b/scripts/mkstdlibs.py index 82c36556..6dbcaa40 100755 --- a/scripts/mkstdlibs.py +++ b/scripts/mkstdlibs.py @@ -4,7 +4,16 @@ 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 = [ + ("2", "7"), + ("3", "6"), + ("3", "7"), + ("3", "8"), + ("3", "9"), + ("3", "10"), + ("3", "11"), + ("3", "12"), +] DOCSTRING = """ File contains the standard library of Python {}. From c4ccf8e3f42c35591df0e85ea6132db4386858ee Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 4 Dec 2023 14:12:31 +0200 Subject: [PATCH 5/7] Run scripts/mkstdlibs.py with Sphinx 6 --- isort/stdlibs/py311.py | 3 + isort/stdlibs/py312.py | 220 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 223 insertions(+) create mode 100644 isort/stdlibs/py312.py 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", +} From 4f0fbc3479ec4f447e19a60d338003221749a5c7 Mon Sep 17 00:00:00 2001 From: staticdev Date: Mon, 4 Dec 2023 19:07:16 +0100 Subject: [PATCH 6/7] Remove unsupported python versions --- scripts/mkstdlibs.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/mkstdlibs.py b/scripts/mkstdlibs.py index 6dbcaa40..9f375be2 100755 --- a/scripts/mkstdlibs.py +++ b/scripts/mkstdlibs.py @@ -5,9 +5,6 @@ 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"), From 0ef29df739f2904431f7524e2059b9edcbece11a Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 4 Dec 2023 22:01:32 +0200 Subject: [PATCH 7/7] Add py312 to stdlibs --- isort/stdlibs/__init__.py | 2 +- isort/stdlibs/py3.py | 12 ++++++++++-- tests/unit/test_importable.py | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) 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/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