diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5c6cc311fd..122c71e917 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -83,20 +83,6 @@ jobs: with: python-version: ${{ matrix.python }} allow-prereleases: true - # Workaround for actions/setup-python#981 on macos - # Workaround for https://github.com/pypa/setuptools/issues/5143 on windows - # (env var only modified for this specific step) - env: - SETUPTOOLS_USE_DISTUTILS: >- - ${{ - ( - ( matrix.platform == 'macos-latest' || matrix.platform == 'windows-latest' ) - && matrix.python == '3.9' - && 'stdlib' - ) - || matrix.distutils - || 'local' - }} - uses: actions/cache@v4 id: cache with: diff --git a/mypy.ini b/mypy.ini index 979e5af00c..9bf8ed4e46 100644 --- a/mypy.ini +++ b/mypy.ini @@ -20,7 +20,7 @@ disable_error_code = # CI should test for all versions, local development gets hints for oldest supported # But our testing setup doesn't allow passing CLI arguments, so local devs have to set this manually. -# python_version = 3.9 +# python_version = 3.X exclude = (?x)( # Avoid scanning Python files in generated folders diff --git a/newsfragments/5222.feature.rst b/newsfragments/5222.feature.rst new file mode 100644 index 0000000000..0edcda9cb0 --- /dev/null +++ b/newsfragments/5222.feature.rst @@ -0,0 +1 @@ +Dropped dependency on :pypi:`importlib_metadata` -- by :user:`Avasam` diff --git a/pyproject.toml b/pyproject.toml index bbfa0dd0ca..ca931b5d9d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ test = [ "pytest-timeout", 'pytest-perf; sys_platform != "cygwin"', # workaround for jaraco/inflect#195, pydantic/pydantic-core#773 (see #3986) # for tools/finalize.py - 'jaraco.develop >= 7.21; python_version >= "3.9" and sys_platform != "cygwin"', + 'jaraco.develop >= 7.21; sys_platform != "cygwin"', "pytest-home >= 0.5", "pytest-subprocess", @@ -98,7 +98,6 @@ core = [ "packaging>=24.2", "more_itertools>=8.8", "jaraco.text>=3.7", - "importlib_metadata>=6; python_version < '3.10'", "tomli>=2.0.1; python_version < '3.11'", "wheel>=0.43.0", diff --git a/pyrightconfig.json b/pyrightconfig.json index da3cd978ce..f5961f47c2 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -11,7 +11,7 @@ "setuptools/_distutils", ], // Our testing setup doesn't allow passing CLI arguments, so local devs have to set this manually. - // "pythonVersion": "3.9", + // "pythonVersion": "3.X", // For now we don't mind if mypy's `type: ignore` comments accidentally suppresses pyright issues "enableTypeIgnoreComments": true, "typeCheckingMode": "basic", diff --git a/setuptools/dist.py b/setuptools/dist.py index e600404198..534596d869 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -60,8 +60,6 @@ for use with `isinstance`. """ _Sequence: TypeAlias = tuple[str, ...] | list[str] -# This is how stringifying _Sequence would look in Python 3.10 -_sequence_type_repr = "tuple[str, ...] | list[str]" _OrderedStrSequence: TypeAlias = str | dict[str, Any] | Sequence[str] """ :meta private: @@ -101,7 +99,7 @@ def assert_string_list(dist, attr: str, value: _Sequence) -> None: assert ''.join(value) != value except (TypeError, ValueError, AttributeError, AssertionError) as e: raise DistutilsSetupError( - f"{attr!r} must be of type <{_sequence_type_repr}> (got {value!r})" + f"{attr!r} must be of type <{_Sequence}> (got {value!r})" ) from e @@ -926,7 +924,7 @@ def _exclude_misc(self, name: str, value: _Sequence) -> None: """Handle 'exclude()' for list/tuple attrs without a special handler""" if not isinstance(value, _sequence): raise DistutilsSetupError( - f"{name}: setting must be of type <{_sequence_type_repr}> (got {value!r})" + f"{name}: setting must be of type <{_Sequence}> (got {value!r})" ) try: old = getattr(self, name) @@ -944,7 +942,7 @@ def _include_misc(self, name: str, value: _Sequence) -> None: if not isinstance(value, _sequence): raise DistutilsSetupError( - f"{name}: setting must be of type <{_sequence_type_repr}> (got {value!r})" + f"{name}: setting must be of type <{_Sequence}> (got {value!r})" ) try: old = getattr(self, name) @@ -986,7 +984,7 @@ def exclude(self, **attrs) -> None: def _exclude_packages(self, packages: _Sequence) -> None: if not isinstance(packages, _sequence): raise DistutilsSetupError( - f"packages: setting must be of type <{_sequence_type_repr}> (got {packages!r})" + f"packages: setting must be of type <{_Sequence}> (got {packages!r})" ) list(map(self.exclude_package, packages))