Skip to content

Commit 0171a76

Browse files
authored
Merge branch 'main' into type-setup-method
2 parents d62dd2d + 1fe0c5d commit 0171a76

File tree

10 files changed

+28
-9
lines changed

10 files changed

+28
-9
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 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

.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/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``.

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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ extend-select = [
2929
"ISC", # flake8-implicit-str-concat
3030
"FURB", # refurb
3131
"PERF", # Perflint
32+
"PIE", # flake8-pie
3233
"PGH", # pygrep-hooks (blanket-* rules)
3334
"PT", # flake8-pytest-style
3435
"RUF10", # unused-noqa & redirected-noqa
@@ -73,6 +74,7 @@ ignore = [
7374
# Suppress nuisance warnings about module-import-not-at-top-of-file (E402) due to workaround for #4476
7475
"setuptools/__init__.py" = ["E402"]
7576
"pkg_resources/__init__.py" = ["E402", "ANN204"]
77+
"pkg_resources/tests/test_resources.py" = ["PT031"]
7678

7779
[lint.isort]
7880
combine-as-imports = true

setuptools/command/bdist_egg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,9 @@ def analyze_egg(egg_dir, stubs):
348348
safe = True
349349
for base, dirs, files in walk_egg(egg_dir):
350350
for name in files:
351-
if name.endswith('.py') or name.endswith('.pyw'):
351+
if name.endswith(('.py', '.pyw')):
352352
continue
353-
elif name.endswith('.pyc') or name.endswith('.pyo'):
353+
elif name.endswith(('.pyc', '.pyo')):
354354
# always scan, even if we already know we're not safe
355355
safe = scan_module(egg_dir, base, name, stubs) and safe
356356
return safe

setuptools/command/egg_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def _maybe_tag(self, version):
146146
def _already_tagged(self, version: str) -> bool:
147147
# Depending on their format, tags may change with version normalization.
148148
# So in addition the regular tags, we have to search for the normalized ones.
149-
return version.endswith(self.vtags) or version.endswith(self._safe_tags())
149+
return version.endswith((self.vtags, self._safe_tags()))
150150

151151
def _safe_tags(self) -> str:
152152
# To implement this we can rely on `safe_version` pretending to be version 0

setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ def test_mixed_extras_require_optional_dependencies(tmp_path):
103103
path.build(files, prefix=tmp_path)
104104
pyproject = tmp_path / "pyproject.toml"
105105

106+
dist = Distribution({"extras_require": {"hello": ["world"]}})
107+
106108
with pytest.warns(SetuptoolsWarning, match=".extras_require. overwritten"):
107-
dist = Distribution({"extras_require": {"hello": ["world"]}})
108109
dist = apply_configuration(dist, pyproject)
109-
assert dist.extras_require == {"docs": ["sphinx"]}
110+
111+
assert dist.extras_require == {"docs": ["sphinx"]}

setuptools/tests/test_build_py.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def test_excluded_subpackages(tmpdir_cwd):
165165
build_py = dist.get_command_obj("build_py")
166166

167167
msg = r"Python recognizes 'mypkg\.tests' as an importable package"
168-
with pytest.warns(SetuptoolsDeprecationWarning, match=msg):
168+
with pytest.warns(SetuptoolsDeprecationWarning, match=msg): # noqa: PT031
169169
# TODO: To fix #3260 we need some transition period to deprecate the
170170
# existing behavior of `include_package_data`. After the transition, we
171171
# should remove the warning and fix the behavior.

0 commit comments

Comments
 (0)