diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d0a5b44af..77a82d0ae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,7 +40,7 @@ jobs: python_version: ['3.12'] include: - os: ubuntu-latest - python_version: '3.10' + python_version: '3.11' timeout-minutes: 180 steps: - uses: actions/checkout@v4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3f43ac2e2..58c697ba5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,9 +24,9 @@ repos: rev: v1.10.0 hooks: - id: mypy - name: mypy 3.10 on cibuildwheel/ + name: mypy 3.11 on cibuildwheel/ exclude: ^cibuildwheel/resources/.*py|bin/generate_schema.py$ - args: ["--python-version=3.10"] + args: ["--python-version=3.11"] additional_dependencies: &mypy-dependencies - bracex - nox diff --git a/bin/bump_version.py b/bin/bump_version.py index e28bdcb97..2c56caff7 100755 --- a/bin/bump_version.py +++ b/bin/bump_version.py @@ -11,17 +11,13 @@ import os import subprocess import sys +import tomllib import urllib.parse from pathlib import Path import click from packaging.version import InvalidVersion, Version -if sys.version_info < (3, 11): - import tomli as tomllib -else: - import tomllib - config = [ # file path, version find/replace format ("pyproject.toml", 'version = "{}"'), diff --git a/bin/update_nodejs.py b/bin/update_nodejs.py index c2cb1c0f0..8a08274ae 100755 --- a/bin/update_nodejs.py +++ b/bin/update_nodejs.py @@ -4,6 +4,7 @@ import difflib import logging +import tomllib from dataclasses import dataclass from pathlib import Path from typing import Final @@ -16,8 +17,6 @@ from rich.logging import RichHandler from rich.syntax import Syntax -from cibuildwheel._compat import tomllib - log = logging.getLogger("cibw") # Looking up the dir instead of using utils.resources_dir diff --git a/bin/update_pythons.py b/bin/update_pythons.py index 2d295c320..5921b427b 100755 --- a/bin/update_pythons.py +++ b/bin/update_pythons.py @@ -5,6 +5,7 @@ import copy import difflib import logging +import tomllib from collections.abc import Mapping, MutableMapping from pathlib import Path from typing import Any, Final, Literal, TypedDict @@ -17,7 +18,6 @@ from rich.logging import RichHandler from rich.syntax import Syntax -from cibuildwheel._compat import tomllib from cibuildwheel.extra import dump_python_configurations log = logging.getLogger("cibw") diff --git a/bin/update_virtualenv.py b/bin/update_virtualenv.py index fc69cf63d..480e1714e 100755 --- a/bin/update_virtualenv.py +++ b/bin/update_virtualenv.py @@ -5,6 +5,7 @@ import difflib import logging import subprocess +import tomllib from dataclasses import dataclass from pathlib import Path from typing import Final @@ -15,8 +16,6 @@ from rich.logging import RichHandler from rich.syntax import Syntax -from cibuildwheel._compat import tomllib - log = logging.getLogger("cibw") # Looking up the dir instead of using utils.resources_dir diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py index a409d725b..d885f39ea 100644 --- a/cibuildwheel/__main__.py +++ b/cibuildwheel/__main__.py @@ -12,7 +12,7 @@ from collections.abc import Iterable, Sequence, Set from pathlib import Path from tempfile import mkdtemp -from typing import Protocol +from typing import Protocol, assert_never import cibuildwheel import cibuildwheel.linux @@ -21,7 +21,6 @@ import cibuildwheel.util import cibuildwheel.windows from cibuildwheel import errors -from cibuildwheel._compat.typing import assert_never from cibuildwheel.architecture import Architecture, allowed_architectures_check from cibuildwheel.logger import log from cibuildwheel.options import CommandLineArguments, Options, compute_options diff --git a/cibuildwheel/_compat/__init__.py b/cibuildwheel/_compat/__init__.py deleted file mode 100644 index 9d48db4f9..000000000 --- a/cibuildwheel/_compat/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import annotations diff --git a/cibuildwheel/_compat/tomllib.py b/cibuildwheel/_compat/tomllib.py deleted file mode 100644 index b061ba911..000000000 --- a/cibuildwheel/_compat/tomllib.py +++ /dev/null @@ -1,10 +0,0 @@ -from __future__ import annotations - -import sys - -if sys.version_info >= (3, 11): - from tomllib import load, loads -else: - from tomli import load, loads - -__all__ = ["load", "loads"] diff --git a/cibuildwheel/_compat/typing.py b/cibuildwheel/_compat/typing.py deleted file mode 100644 index 05bae73e0..000000000 --- a/cibuildwheel/_compat/typing.py +++ /dev/null @@ -1,14 +0,0 @@ -from __future__ import annotations - -import sys - -if sys.version_info < (3, 11): - from typing_extensions import NotRequired, Self, assert_never -else: - from typing import NotRequired, Self, assert_never - -__all__ = ( - "assert_never", - "NotRequired", - "Self", -) diff --git a/cibuildwheel/architecture.py b/cibuildwheel/architecture.py index 75def59c5..e50f5b9a5 100644 --- a/cibuildwheel/architecture.py +++ b/cibuildwheel/architecture.py @@ -6,9 +6,8 @@ import sys from collections.abc import Set from enum import Enum -from typing import Final, Literal +from typing import Final, Literal, assert_never -from ._compat.typing import assert_never from .typing import PlatformName PRETTY_NAMES: Final[dict[PlatformName, str]] = { diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index a13a557aa..ffc930dea 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -7,11 +7,11 @@ from collections.abc import Iterable, Iterator, Sequence, Set from dataclasses import dataclass from pathlib import Path, PurePath, PurePosixPath +from typing import assert_never from packaging.version import Version from . import errors -from ._compat.typing import assert_never from .architecture import Architecture from .logger import log from .oci_container import OCIContainer, OCIContainerEngineConfig diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index cae37e210..66d60ff16 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -11,13 +11,12 @@ from collections.abc import Sequence, Set from dataclasses import dataclass from pathlib import Path -from typing import Literal +from typing import Literal, assert_never from filelock import FileLock from packaging.version import Version from . import errors -from ._compat.typing import assert_never from .architecture import Architecture from .environment import ParsedEnvironment from .logger import log diff --git a/cibuildwheel/oci_container.py b/cibuildwheel/oci_container.py index c0c8d2281..85003e7e0 100644 --- a/cibuildwheel/oci_container.py +++ b/cibuildwheel/oci_container.py @@ -14,9 +14,8 @@ from dataclasses import dataclass, field from pathlib import Path, PurePath, PurePosixPath from types import TracebackType -from typing import IO, Literal +from typing import IO, Literal, Self -from ._compat.typing import Self from .typing import PathOrStr, PopenBytes from .util import ( CIProvider, diff --git a/cibuildwheel/options.py b/cibuildwheel/options.py index 52dfa63ef..d1f2aae3c 100644 --- a/cibuildwheel/options.py +++ b/cibuildwheel/options.py @@ -9,6 +9,7 @@ import functools import shlex import textwrap +import tomllib from collections.abc import ( Callable, Generator, @@ -19,13 +20,11 @@ Set, ) from pathlib import Path -from typing import Any, Literal, TypedDict +from typing import Any, Literal, NotRequired, TypedDict, assert_never from packaging.specifiers import SpecifierSet from . import errors -from ._compat import tomllib -from ._compat.typing import NotRequired, assert_never from .architecture import Architecture from .environment import EnvironmentParseError, ParsedEnvironment, parse_environment from .logger import log diff --git a/cibuildwheel/projectfiles.py b/cibuildwheel/projectfiles.py index 73593fc74..839d99953 100644 --- a/cibuildwheel/projectfiles.py +++ b/cibuildwheel/projectfiles.py @@ -3,10 +3,9 @@ import ast import configparser import contextlib +import tomllib from pathlib import Path -from ._compat import tomllib - def get_parent(node: ast.AST | None, depth: int = 1) -> ast.AST | None: for _ in range(depth): diff --git a/cibuildwheel/util.py b/cibuildwheel/util.py index 223e39be0..3c3869af5 100644 --- a/cibuildwheel/util.py +++ b/cibuildwheel/util.py @@ -13,6 +13,7 @@ import tarfile import textwrap import time +import tomllib import typing import urllib.request from collections import defaultdict @@ -35,7 +36,6 @@ from packaging.version import Version from platformdirs import user_cache_path -from ._compat import tomllib from .architecture import Architecture from .typing import PathOrStr, PlatformName diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index 6b07e534a..fd385be58 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -9,12 +9,12 @@ from dataclasses import dataclass from functools import cache from pathlib import Path +from typing import assert_never from filelock import FileLock from packaging.version import Version from . import errors -from ._compat.typing import assert_never from .architecture import Architecture from .environment import ParsedEnvironment from .logger import log diff --git a/pyproject.toml b/pyproject.toml index 5e34e95e3..85623baa6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ version = "2.19.1" description = "Build Python wheels on CI with minimal configuration." readme = "README.md" license = "BSD-2-Clause" -requires-python = ">=3.10" +requires-python = ">=3.11" authors = [ { name = "Joe Rickerby", email = "joerick@mac.com" }, ] @@ -30,7 +30,6 @@ classifiers = [ "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", @@ -42,9 +41,7 @@ dependencies = [ "certifi", "filelock", "packaging>=20.9", - "platformdirs", - "tomli;python_version < '3.11'", - "typing-extensions>=4.1.0;python_version < '3.11'", + "platformdirs" ] [project.optional-dependencies] @@ -104,7 +101,7 @@ log_cli_level = "info" [tool.mypy] -python_version = "3.10" +python_version = "3.11" files = [ "cibuildwheel/*.py", "test/**/*.py", @@ -147,7 +144,7 @@ ignore_missing_imports = true [tool.pylint] -py-version = "3.10" +py-version = "3.11" jobs = "0" fail-on = ["E", "F"] fail-under = "9.8" @@ -184,7 +181,7 @@ messages_control.disable = [ ] [tool.ruff] -target-version = "py310" +target-version = "py311" line-length = 100 @@ -220,7 +217,6 @@ ignore = [ "PYI025", # Set as AbstractSet "ISC001", # Conflicts with formatter ] -typing-modules = ["cibuildwheel._compat.typing"] flake8-unused-arguments.ignore-variadic-names = true [tool.ruff.lint.flake8-tidy-imports.banned-api] @@ -229,14 +225,9 @@ flake8-unused-arguments.ignore-variadic-names = true "typing.Iterator".msg = "Use collections.abc.Iterator instead." "typing.Sequence".msg = "Use collections.abc.Sequence instead." "typing.Set".msg = "Use collections.abc.Set instead." -"typing.NotRequired".msg = "Use cibuildwheel._compat.typing.NotRequired instead." -"typing.assert_never".msg = "Use cibuildwheel._compat.typing.assert_never instead." -"tomllib".msg = "Use cibuildwheel._compat.tomllib instead." -"tomli".msg = "Use cibuildwheel._compat.tomllib instead." [tool.ruff.lint.per-file-ignores] "unit_test/*" = ["PLC1901"] -"cibuildwheel/_compat/**.py" = ["TID251"] "bin/*" = ["TID251"] [tool.repo-review] diff --git a/unit_test/build_ids_test.py b/unit_test/build_ids_test.py index a42af93de..0a444e85c 100644 --- a/unit_test/build_ids_test.py +++ b/unit_test/build_ids_test.py @@ -1,8 +1,9 @@ from __future__ import annotations +import tomllib + from packaging.version import Version -from cibuildwheel._compat import tomllib from cibuildwheel.extra import Printable, dump_python_configurations from cibuildwheel.util import resources_dir diff --git a/unit_test/main_tests/main_options_test.py b/unit_test/main_tests/main_options_test.py index acd37c1bc..979dc9d1b 100644 --- a/unit_test/main_tests/main_options_test.py +++ b/unit_test/main_tests/main_options_test.py @@ -1,13 +1,13 @@ from __future__ import annotations import sys +import tomllib from fnmatch import fnmatch from pathlib import Path import pytest from cibuildwheel.__main__ import main -from cibuildwheel._compat import tomllib from cibuildwheel.environment import ParsedEnvironment from cibuildwheel.options import BuildOptions, _get_pinned_container_images from cibuildwheel.util import BuildSelector, resources_dir, split_config_settings diff --git a/unit_test/validate_schema_test.py b/unit_test/validate_schema_test.py index 698353990..25dc2c347 100644 --- a/unit_test/validate_schema_test.py +++ b/unit_test/validate_schema_test.py @@ -1,13 +1,12 @@ from __future__ import annotations import re +import tomllib from pathlib import Path import pytest import validate_pyproject.api -from cibuildwheel._compat import tomllib - DIR = Path(__file__).parent.resolve()