Skip to content

Commit a9efffe

Browse files
committed
Merge branch 'main' of https://github.com/pypa/setuptools into Bump-Ruff-and-mypy
2 parents d149e5a + d198e86 commit a9efffe

32 files changed

+174
-120
lines changed

.github/workflows/main.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
matrix:
4343
python:
4444
- "3.9"
45-
- "3.13"
45+
- ">=3.13.5" # temporary bound until it becomes the default, python/cpython#135151
4646
platform:
4747
- ubuntu-latest
4848
- macos-latest
@@ -157,6 +157,7 @@ jobs:
157157
if: always()
158158

159159
needs:
160+
- check-changed-folders
160161
- integration-test
161162
- test
162163
- collateral
@@ -228,6 +229,38 @@ jobs:
228229
VM-${{ matrix.platform }},
229230
Py-${{ steps.python-install.outputs.python-version }}
230231
token: ${{ secrets.CODECOV_TOKEN }}
232+
233+
check-changed-folders:
234+
name: Fail the job if files changed under _disutils/_vendor folders
235+
if: github.event_name == 'pull_request'
236+
runs-on: ubuntu-latest
237+
steps:
238+
- name: Checkout code
239+
uses: actions/checkout@v3
240+
with:
241+
fetch-depth: 0
242+
- name: Check if files changed in the _distutils folder
243+
id: changed-files-specific-distutils
244+
uses: tj-actions/changed-files@v34
245+
with:
246+
files: |
247+
setuptools/_distutils/**
248+
- name: Check if files changed in the _vendor folder
249+
id: changed-files-specific-vendor
250+
uses: tj-actions/changed-files@v34
251+
with:
252+
files: |
253+
setuptools/_vendor/**
254+
- name: Fail the job if any file(s) in the _distutils folder change
255+
if: steps.changed-files-specific-distutils.outputs.any_changed == 'true'
256+
run: |
257+
echo "One or more files in the setuptools/_distutils folder has changed." | tee "${GITHUB_STEP_SUMMARY}"
258+
exit 1
259+
- name: Fail the job if any file(s) in the _vendor folder change
260+
if: steps.changed-files-specific-vendor.outputs.any_changed == 'true'
261+
run: |
262+
echo "One or more files in the setuptools/_vendor folder has changed." | tee "${GITHUB_STEP_SUMMARY}"
263+
exit 1
231264
232265
integration-test:
233266
needs: test

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.9.9
3+
rev: v0.12.0
44
hooks:
55
- id: ruff
66
args: [--fix, --unsafe-fixes]

docs/userguide/interfaces.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ reserve the right of speeding up the deprecation cycle and shortening deprecatio
5050
Note that these are exceptional circumstances and that the project will
5151
carefully attempt to find alternatives before resorting to unscheduled removals.
5252

53+
.. important::
54+
In the context of ``setuptools``, the introduction of :py:mod:`warnings`
55+
(including deprecation warnings) is not considered a breaking change *per se*.
56+
Instead it is considered a backwards compatible *communication action* that
57+
precedes an upcoming breaking change. This is becauset code
58+
containing warnings typically does not fail and can successfully terminate
59+
execution, unless users explicitly opt into transforming those warnings
60+
into errors (e.g., via Python's :external+python:ref:`-W option or
61+
PYTHONWARNINGS environment variable <using-on-warnings>`).
62+
5363

5464
What to do when deprecation periods are undefined?
5565
--------------------------------------------------
@@ -147,7 +157,7 @@ you can still resort to restricting the version of Setuptools to be installed.
147157
This usually includes modifying ``[build-system] requires`` in ``pyproject.toml``
148158
and/or specifying ``pip`` :external+pip:ref:`Constraints Files` via
149159
the ``PIP_CONSTRAINT`` environment variable (or passing |build-constraint-uv|_).
150-
Please avoid however to pre-emptively add version constraints if not necessary,
160+
Please avoid however to preemptively add version constraints if not necessary,
151161
(you can read more about this in https://iscinumpy.dev/post/bound-version-constraints/).
152162

153163
.. |build-constraint-uv| replace:: ``--build-constraint`` to ``uv``

newsfragments/4530.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove post-release tags on setuptools' own build.

newsfragments/5033.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Avoid repeated calls to ``str.startswith`` and ``str.endswith``.

pkg_resources/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ class _ZipLoaderModule(Protocol):
131131
__loader__: zipimport.zipimporter
132132

133133

134-
_PEP440_FALLBACK = re.compile(r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.I)
134+
_PEP440_FALLBACK = re.compile(
135+
r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.IGNORECASE
136+
)
135137

136138

137139
class PEP440Warning(RuntimeWarning):

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ test = [
5656
"tomli-w>=1.0.0",
5757
"pytest-timeout",
5858
'pytest-perf; sys_platform != "cygwin"', # workaround for jaraco/inflect#195, pydantic/pydantic-core#773 (see #3986)
59+
'pyobjc<12; sys_platform == "darwin" and python_version <= "3.9"', # workaround for #5105
5960
# for tools/finalize.py
6061
'jaraco.develop >= 7.21; python_version >= "3.9" and sys_platform != "cygwin"',
6162
"pytest-home >= 0.5",

pytest.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,7 @@ filterwarnings=
9595

9696
# Ignore warnings about consider_namespace_packages (jaraco/skeleton@6ff02e0eefcd)
9797
ignore:Unknown config option. consider_namespace_packages:pytest.PytestConfigWarning
98+
99+
# Ignore warnings we cannot do anything about:
100+
# https://github.com/pypa/setuptools/pull/5042#issuecomment-2981138461
101+
ignore:Couldn't import C tracer:coverage.exceptions.CoverageWarning

ruff.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ extend-select = [
2727
# local
2828
"ANN2", # missing-return-type-*
2929
"ISC", # flake8-implicit-str-concat
30+
"FURB", # refurb
3031
"PERF", # Perflint
32+
"PIE", # flake8-pie
3133
"PGH", # pygrep-hooks (blanket-* rules)
3234
"PT", # flake8-pytest-style
3335
"RUF10", # unused-noqa & redirected-noqa
@@ -65,13 +67,14 @@ ignore = [
6567
"UP015", # redundant-open-modes, explicit is preferred
6668
# Only enforcing return type annotations for public functions
6769
"ANN202", # missing-return-type-private-function
68-
"ANN204", # missing-return-type-special-method
6970
]
7071

7172
[lint.per-file-ignores]
7273
# Suppress nuisance warnings about module-import-not-at-top-of-file (E402) due to workaround for #4476
7374
"setuptools/__init__.py" = ["E402"]
74-
"pkg_resources/__init__.py" = ["E402"]
75+
# pkg_resources is due for removal, not worth fixing existing errors
76+
"pkg_resources/__init__.py" = ["E402", "ANN204"]
77+
"pkg_resources/tests/test_resources.py" = ["PT031"]
7578

7679
[lint.isort]
7780
combine-as-imports = true

setup.cfg

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)