Skip to content
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
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,29 @@ jobs:
# https://blog.jaraco.com/efficient-use-of-ci-resources/
matrix:
python:
- "3.9"
- "3.10"
- ">=3.13.5" # temporary bound until it becomes the default, python/cpython#135151
platform:
- ubuntu-latest
- macos-latest
- windows-latest
include:
- python: "3.10"
platform: ubuntu-latest
- python: "3.11"
platform: ubuntu-latest
- python: "3.12"
platform: ubuntu-latest
- python: "3.14"
platform: ubuntu-latest
- python: "3.15"
platform: ubuntu-latest
- python: pypy3.10
platform: ubuntu-latest
distutils: stdlib
- platform: ubuntu-latest
python: "3.10"
distutils: stdlib
runs-on: ${{ matrix.platform }}
continue-on-error: ${{ matrix.python == '3.14' || matrix.python == 'pypy3.10' }}
continue-on-error: ${{ matrix.python == '3.15' || matrix.python == 'pypy3.10' }}
# XXX: pypy seems to be flaky with unrelated tests in #6345
env:
SETUPTOOLS_USE_DISTUTILS: ${{ matrix.distutils || 'local' }}
Expand All @@ -73,7 +73,7 @@ jobs:
- name: Install build dependencies
# Install dependencies for building packages on pre-release Pythons
# jaraco/skeleton#161
if: matrix.python == '3.14' && matrix.platform == 'ubuntu-latest'
if: matrix.python == '3.15' && matrix.platform == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install -y libxml2-dev libxslt-dev
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
strategy:
matrix:
python:
- 39
- 312
platform:
- windows-latest
runs-on: ${{ matrix.platform }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pyright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
# https://blog.jaraco.com/efficient-use-of-ci-resources/
matrix:
python:
- "3.9"
- "3.13"
- "3.10"
- "3.14"
platform:
- ubuntu-latest
runs-on: ${{ matrix.platform }}
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
.. |docs-badge| image:: https://img.shields.io/readthedocs/setuptools/latest.svg
:target: https://setuptools.pypa.io

.. |skeleton-badge| image:: https://img.shields.io/badge/skeleton-2025-informational
.. |skeleton-badge| image:: https://img.shields.io/badge/skeleton-2026-informational
:target: https://blog.jaraco.com/skeleton

.. |codecov-badge| image:: https://img.shields.io/codecov/c/github/pypa/setuptools/master.svg?logo=codecov&logoColor=white
Expand Down
1 change: 1 addition & 0 deletions newsfragments/+0af71c41.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Require Python 3.10 or later.
10 changes: 6 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ classifiers = [
"Topic :: System :: Systems Administration",
"Topic :: Utilities",
]
requires-python = ">=3.9"
requires-python = ">=3.10"
license = "MIT"
dependencies = [
]
Expand Down Expand Up @@ -109,7 +109,7 @@ core = [

check = [
# upstream
"pytest-checkdocs >= 2.4",
"pytest-checkdocs >= 2.14",
"pytest-ruff >= 0.2.1; sys_platform != 'cygwin'",

# local
Expand All @@ -123,12 +123,14 @@ cover = [
]

enabler = [
"pytest-enabler >= 2.2",
"pytest-enabler >= 3.4",
]

type = [
# upstream
"pytest-mypy",

# Exclude PyPy from type checks (python/mypy#20454 jaraco/skeleton#187)
"pytest-mypy >= 1.0.1; platform_python_implementation != 'PyPy'",

# local

Expand Down
9 changes: 1 addition & 8 deletions setuptools/_importlib.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
import sys

if sys.version_info < (3, 10):
import importlib_metadata as metadata # pragma: no cover
else:
import importlib.metadata as metadata # noqa: F401


import importlib.metadata as metadata # noqa: F401
import importlib.resources as resources # noqa: F401
8 changes: 4 additions & 4 deletions setuptools/_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import contextlib
import os
import sys
from typing import TYPE_CHECKING, TypeVar, Union
from typing import TYPE_CHECKING, TypeVar

from more_itertools import unique_everseen

if TYPE_CHECKING:
from typing_extensions import TypeAlias
from typing import TypeAlias

StrPath: TypeAlias = Union[str, os.PathLike[str]] # Same as _typeshed.StrPath
StrPathT = TypeVar("StrPathT", bound=Union[str, os.PathLike[str]])
StrPath: TypeAlias = str | os.PathLike[str] # Same as _typeshed.StrPath
StrPathT = TypeVar("StrPathT", bound=str | os.PathLike[str])


def ensure_directory(path):
Expand Down
8 changes: 4 additions & 4 deletions setuptools/_reqs.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
from __future__ import annotations

from collections.abc import Iterable, Iterator
from collections.abc import Callable, Iterable, Iterator
from functools import lru_cache
from typing import TYPE_CHECKING, Callable, TypeVar, Union, overload
from typing import TYPE_CHECKING, TypeVar, overload

import jaraco.text as text
from packaging.requirements import Requirement

if TYPE_CHECKING:
from typing_extensions import TypeAlias
from typing import TypeAlias

_T = TypeVar("_T")
_StrOrIter: TypeAlias = Union[str, Iterable[str]]
_StrOrIter: TypeAlias = str | Iterable[str]


parse_req: Callable[[str], Requirement] = lru_cache()(Requirement)
Expand Down
3 changes: 2 additions & 1 deletion setuptools/_shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import os
import stat
from typing import Callable, TypeVar
from collections.abc import Callable
from typing import TypeVar

from .compat import py311

Expand Down
6 changes: 3 additions & 3 deletions setuptools/build_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import warnings
from collections.abc import Iterable, Iterator, Mapping
from pathlib import Path
from typing import TYPE_CHECKING, NoReturn, Union
from typing import TYPE_CHECKING, NoReturn

import setuptools

Expand All @@ -52,7 +52,7 @@
from distutils.util import strtobool

if TYPE_CHECKING:
from typing_extensions import TypeAlias
from typing import TypeAlias

__all__ = [
'get_requires_for_build_sdist',
Expand Down Expand Up @@ -144,7 +144,7 @@ def suppress_known_deprecation():
yield


_ConfigSettings: TypeAlias = Union[Mapping[str, Union[str, list[str], None]], None]
_ConfigSettings: TypeAlias = Mapping[str, str | list[str] | None] | None
"""
Currently the user can run::

Expand Down
3 changes: 2 additions & 1 deletion setuptools/command/bdist_egg.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
from distutils.dir_util import mkpath, remove_tree

if TYPE_CHECKING:
from typing import TypeAlias

from _typeshed import GenericPath
from typing_extensions import TypeAlias

# Same as zipfile._ZipFileMode from typeshed
_ZipFileMode: TypeAlias = Literal["r", "w", "x", "a"]
Expand Down
6 changes: 4 additions & 2 deletions setuptools/compat/py311.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import shutil
import sys
from typing import TYPE_CHECKING, Any, Callable
from collections.abc import Callable
from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
from typing import TypeAlias

from _typeshed import ExcInfo, StrOrBytesPath
from typing_extensions import TypeAlias

# Same as shutil._OnExcCallback from typeshed
_OnExcCallback: TypeAlias = Callable[[Callable[..., Any], str, BaseException], object]
Expand Down
3 changes: 2 additions & 1 deletion setuptools/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
``setuptools.config.setupcfg``
"""

from collections.abc import Callable
from functools import wraps
from typing import Callable, TypeVar, cast
from typing import TypeVar, cast

from ..warnings import SetuptoolsDeprecationWarning
from . import setupcfg
Expand Down
10 changes: 5 additions & 5 deletions setuptools/config/_apply_pyprojecttoml.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

import logging
import os
from collections.abc import Mapping
from collections.abc import Callable, Mapping
from email.headerregistry import Address
from functools import partial, reduce
from inspect import cleandoc
from itertools import chain
from types import MappingProxyType
from typing import TYPE_CHECKING, Any, Callable, TypeVar, Union
from typing import TYPE_CHECKING, Any, TypeVar

from .. import _static
from .._path import StrPath
Expand All @@ -27,17 +27,17 @@
from ..warnings import SetuptoolsDeprecationWarning, SetuptoolsWarning

if TYPE_CHECKING:
from typing_extensions import TypeAlias
from typing import TypeAlias

from setuptools._importlib import metadata
from setuptools.dist import Distribution

from distutils.dist import _OptionsList # Comes from typeshed

Check warning on line 35 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.14, ubuntu-latest)

"_OptionsList" is unknown import symbol (reportAttributeAccessIssue)

Check warning on line 35 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.14, ubuntu-latest)

Import "distutils.dist" could not be resolved from source (reportMissingModuleSource)

Check warning on line 35 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.14, ubuntu-latest)

"_OptionsList" is unknown import symbol (reportAttributeAccessIssue)

Check warning on line 35 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.14, ubuntu-latest)

Import "distutils.dist" could not be resolved from source (reportMissingModuleSource)


EMPTY: Mapping = MappingProxyType({}) # Immutable dict-like
_ProjectReadmeValue: TypeAlias = Union[str, dict[str, str]]
_Correspondence: TypeAlias = Callable[["Distribution", Any, Union[StrPath, None]], None]
_ProjectReadmeValue: TypeAlias = str | dict[str, str]
_Correspondence: TypeAlias = Callable[["Distribution", Any, StrPath | None], None]
_T = TypeVar("_T")

_logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -405,7 +405,7 @@
>>> _attrgetter("d")(obj) is None
True
"""
return partial(reduce, lambda acc, x: getattr(acc, x, None), attr.split("."))

Check warning on line 408 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.14, ubuntu-latest)

Argument of type "_S@reduce" cannot be assigned to parameter "name" of type "str" in function "getattr"   "object*" is not assignable to "str" (reportArgumentType)

Check warning on line 408 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.14, ubuntu-latest)

No overloads for "getattr" match the provided arguments (reportCallIssue)

Check warning on line 408 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.10, ubuntu-latest)

Argument of type "_S@reduce" cannot be assigned to parameter "name" of type "str" in function "getattr"   "object*" is not assignable to "str" (reportArgumentType)

Check warning on line 408 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.10, ubuntu-latest)

No overloads for "getattr" match the provided arguments (reportCallIssue)

Check warning on line 408 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.14, ubuntu-latest)

Argument of type "_S@reduce" cannot be assigned to parameter "name" of type "str" in function "getattr"   "object*" is not assignable to "str" (reportArgumentType)

Check warning on line 408 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.14, ubuntu-latest)

No overloads for "getattr" match the provided arguments (reportCallIssue)

Check warning on line 408 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.10, ubuntu-latest)

Argument of type "_S@reduce" cannot be assigned to parameter "name" of type "str" in function "getattr"   "object*" is not assignable to "str" (reportArgumentType)

Check warning on line 408 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.10, ubuntu-latest)

No overloads for "getattr" match the provided arguments (reportCallIssue)


def _some_attrgetter(*items):
Expand Down
4 changes: 2 additions & 2 deletions setuptools/config/expand.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
import os
import pathlib
import sys
from collections.abc import Iterable, Iterator, Mapping
from collections.abc import Callable, Iterable, Iterator, Mapping
from configparser import ConfigParser
from glob import iglob
from importlib.machinery import ModuleSpec, all_suffixes
from itertools import chain
from pathlib import Path
from types import ModuleType, TracebackType
from typing import TYPE_CHECKING, Any, Callable, TypeVar
from typing import TYPE_CHECKING, Any, TypeVar

from .. import _static
from .._path import StrPath, same_path as _same_path
Expand All @@ -56,7 +56,7 @@
def __init__(self, name: str, spec: ModuleSpec) -> None:
module = ast.parse(pathlib.Path(spec.origin).read_bytes()) # type: ignore[arg-type] # Let it raise an error on None
vars(self).update(locals())
del self.self

Check warning on line 59 in setuptools/config/expand.py

View workflow job for this annotation

GitHub Actions / pyright (3.10, ubuntu-latest)

Cannot delete attribute "self" for class "StaticModule*"   Attribute "self" is unknown (reportAttributeAccessIssue)

def _find_assignments(self) -> Iterator[tuple[ast.AST, ast.AST]]:
for statement in self.module.body:
Expand Down
4 changes: 2 additions & 2 deletions setuptools/config/pyprojecttoml.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

import logging
import os
from collections.abc import Mapping
from collections.abc import Callable, Mapping
from contextlib import contextmanager
from functools import partial
from types import TracebackType
from typing import TYPE_CHECKING, Any, Callable
from typing import TYPE_CHECKING, Any

from .._path import StrPath
from ..errors import FileError, InvalidConfigError
Expand Down
6 changes: 3 additions & 3 deletions setuptools/config/setupcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import os
from abc import abstractmethod
from collections import defaultdict
from collections.abc import Iterable, Iterator
from collections.abc import Callable, Iterable, Iterator
from functools import partial, wraps
from typing import TYPE_CHECKING, Any, Callable, ClassVar, Generic, TypeVar, cast
from typing import TYPE_CHECKING, Any, ClassVar, Generic, TypeVar, cast

from packaging.markers import default_environment as marker_env
from packaging.requirements import InvalidRequirement, Requirement
Expand All @@ -31,7 +31,7 @@
from . import expand

if TYPE_CHECKING:
from typing_extensions import TypeAlias
from typing import TypeAlias

from setuptools.dist import Distribution

Expand Down
8 changes: 4 additions & 4 deletions setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from collections.abc import Iterable, Iterator, MutableMapping, Sequence
from glob import glob
from pathlib import Path
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any

from more_itertools import partition, unique_everseen
from packaging.markers import InvalidMarker, Marker
Expand Down Expand Up @@ -44,7 +44,7 @@
from distutils.util import strtobool

if TYPE_CHECKING:
from typing_extensions import TypeAlias
from typing import TypeAlias


__all__ = ['Distribution']
Expand All @@ -59,10 +59,10 @@
- not imply a nested type (like `dict`)
for use with `isinstance`.
"""
_Sequence: TypeAlias = Union[tuple[str, ...], list[str]]
_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 = Union[str, dict[str, Any], Sequence[str]]
_OrderedStrSequence: TypeAlias = str | dict[str, Any] | Sequence[str]
"""
:meta private:
Avoid single-use iterable. Disallow sets.
Expand Down
3 changes: 2 additions & 1 deletion setuptools/tests/test_build_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import sys
import tarfile
import warnings
from collections.abc import Callable
from concurrent import futures
from pathlib import Path
from typing import Any, Callable
from typing import Any
from zipfile import ZipFile

import pytest
Expand Down
2 changes: 1 addition & 1 deletion setuptools/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from typing_extensions import TypeAlias
from typing import TypeAlias

_DueDate: TypeAlias = tuple[int, int, int] # time tuple
_INDENT = 8 * " "
Expand Down
3 changes: 1 addition & 2 deletions towncrier.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[tool.towncrier]
title_format = "{version}"
# workaround for sphinx-contrib/sphinxcontrib-towncrier#83
directory = "newsfragments"
directory = "newsfragments" # jaraco/skeleton#184
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ deps =
diff-cover
commands =
pytest {posargs} --cov-report xml
diff-cover coverage.xml --compare-branch=origin/main --html-report diffcov.html
diff-cover coverage.xml --compare-branch=origin/main --format html:diffcov.html
diff-cover coverage.xml --compare-branch=origin/main --fail-under=100

[testenv:docs]
Expand Down
Loading