Skip to content

Commit 33bd900

Browse files
authored
Merge branch 'main' into generate-distuttils-stubs-on-install
2 parents 509e26a + d198e86 commit 33bd900

File tree

17 files changed

+78
-71
lines changed

17 files changed

+78
-71
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``.

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: 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

setup.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python
22

33
import os
4-
import sys
54
import textwrap
65

76
import setuptools
@@ -10,33 +9,6 @@
109
here = os.path.dirname(__file__)
1110

1211

13-
package_data = {
14-
"": ["LICEN[CS]E*", "COPYING*", "NOTICE*", "AUTHORS*"],
15-
"setuptools": ['script (dev).tmpl', 'script.tmpl', 'site-patch.py'],
16-
}
17-
18-
force_windows_specific_files = os.environ.get(
19-
"SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES", "1"
20-
).lower() not in ("", "0", "false", "no")
21-
22-
include_windows_files = sys.platform == 'win32' or force_windows_specific_files
23-
24-
if include_windows_files:
25-
package_data.setdefault('setuptools', []).extend(['*.exe'])
26-
package_data.setdefault('setuptools.command', []).extend(['*.xml'])
27-
28-
29-
def pypi_link(pkg_filename):
30-
"""
31-
Given the filename, including md5 fragment, construct the
32-
dependency link for PyPI.
33-
"""
34-
root = 'https://files.pythonhosted.org/packages/source'
35-
name, _sep, _rest = pkg_filename.partition('-')
36-
parts = root, name[0], name, pkg_filename
37-
return '/'.join(parts)
38-
39-
4012
class install_with_pth(install):
4113
"""
4214
Custom install command to install a .pth file for distutils patching.
@@ -84,7 +56,6 @@ def _restore_install_lib(self):
8456

8557
setup_params = dict(
8658
cmdclass={'install': install_with_pth},
87-
package_data=package_data,
8859
)
8960

9061
if __name__ == '__main__':

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

0 commit comments

Comments
 (0)