Skip to content

Commit cb18737

Browse files
authored
Merge branch 'main' into fix/3777
2 parents c1bf7c7 + fb7f3d3 commit cb18737

File tree

99 files changed

+1074
-619
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1074
-619
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 75.6.0
2+
current_version = 75.8.0
33
commit = True
44
tag = True
55

.github/workflows/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ jobs:
9090
if: steps.cache.outputs.cache-hit != 'true'
9191
working-directory: setuptools/tests/config
9292
run: python -m downloads.preload setupcfg_examples.txt
93+
- name: Adjust env vars
94+
shell: bash
95+
run: |
96+
echo 'PIPX_DEFAULT_PYTHON=${{ steps.python-install.outputs.python-path }}' >> $GITHUB_ENV
9397
- name: Pre-build distributions for test
9498
shell: bash
9599
run: |

.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.7.1
3+
rev: v0.8.0
44
hooks:
55
- id: ruff
66
args: [--fix, --unsafe-fixes]

NEWS.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
v75.8.0
2+
=======
3+
4+
Features
5+
--------
6+
7+
- Implemented ``Dynamic`` field for core metadata (as introduced in PEP 643).
8+
The existing implementation is currently experimental and the exact approach
9+
may change in future releases. (#4698)
10+
11+
12+
v75.7.0
13+
=======
14+
15+
Features
16+
--------
17+
18+
- Synced with pypa/distutils@c97a3db2f including better support for free threaded Python on Windows (pypa/distutils#310), improved typing support, and linter accommodations. (#4478)
19+
- Synced with pypa/distutils@ff11eed0c including bugfix for duplicate CFLAGS and adaption to support Python 3.13 is_abs in the C compiler (#4669). (#4790)
20+
21+
122
v75.6.0
223
=======
324

docs/userguide/extension.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ a non-``None`` value. Here's an example validation function::
122122
"""Verify that value is True, False, 0, or 1"""
123123
if bool(value) != value:
124124
raise SetupError(
125-
"%r must be a boolean value (got %r)" % (attr,value)
125+
f"{attr!r} must be a boolean value (got {value!r}"
126126
)
127127

128128
Your function should accept three arguments: the ``Distribution`` object,

docs/userguide/quickstart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Package discovery
199199
-----------------
200200
For projects that follow a simple directory structure, ``setuptools`` should be
201201
able to automatically detect all :term:`packages <package>` and
202-
:term:`namespaces <namespace-package>`. However, complex projects might include
202+
:term:`namespaces <namespace package>`. However, complex projects might include
203203
additional folders and supporting files that not necessarily should be
204204
distributed (or that can confuse ``setuptools`` auto discovery algorithm).
205205

mypy.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ ignore_missing_imports = True
5858

5959
# - wheel: does not intend on exposing a programmatic API https://github.com/pypa/wheel/pull/610#issuecomment-2081687671
6060
[mypy-wheel.*]
61-
ignore_missing_imports = True
61+
follow_untyped_imports = True
6262
# - The following are not marked as py.typed:
6363
# - jaraco: Since mypy 1.12, the root name of the untyped namespace package gets called-out too
6464
# - jaraco.develop: https://github.com/jaraco/jaraco.develop/issues/22
6565
# - jaraco.envs: https://github.com/jaraco/jaraco.envs/issues/7
6666
# - jaraco.packaging: https://github.com/jaraco/jaraco.packaging/issues/20
6767
# - jaraco.path: https://github.com/jaraco/jaraco.path/issues/2
6868
# - jaraco.text: https://github.com/jaraco/jaraco.text/issues/17
69-
[mypy-jaraco,jaraco.develop,jaraco.envs,jaraco.packaging.*,jaraco.path,jaraco.text]
70-
ignore_missing_imports = True
69+
[mypy-jaraco,jaraco.develop.*,jaraco.envs,jaraco.packaging.*,jaraco.path,jaraco.text]
70+
follow_untyped_imports = True
7171

7272
# Even when excluding a module, import issues can show up due to following import
7373
# https://github.com/python/mypy/issues/11936#issuecomment-1466764006

pkg_resources/__init__.py

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ def get_supported_platform():
200200
m = macosVersionString.match(plat)
201201
if m is not None and sys.platform == "darwin":
202202
try:
203-
plat = 'macosx-%s-%s' % ('.'.join(_macos_vers()[:2]), m.group(3))
203+
major_minor = '.'.join(_macos_vers()[:2])
204+
build = m.group(3)
205+
plat = f'macosx-{major_minor}-{build}'
204206
except ValueError:
205207
# not macOS
206208
pass
@@ -449,12 +451,8 @@ def get_build_platform():
449451
if sys.platform == "darwin" and not plat.startswith('macosx-'):
450452
try:
451453
version = _macos_vers()
452-
machine = os.uname()[4].replace(" ", "_")
453-
return "macosx-%d.%d-%s" % (
454-
int(version[0]),
455-
int(version[1]),
456-
_macos_arch(machine),
457-
)
454+
machine = _macos_arch(os.uname()[4].replace(" ", "_"))
455+
return f"macosx-{version[0]}.{version[1]}-{machine}"
458456
except ValueError:
459457
# if someone is running a non-Mac darwin system, this will fall
460458
# through to the default implementation
@@ -492,7 +490,7 @@ def compatible_platforms(provided: str | None, required: str | None) -> bool:
492490
provDarwin = darwinVersionString.match(provided)
493491
if provDarwin:
494492
dversion = int(provDarwin.group(1))
495-
macosversion = "%s.%s" % (reqMac.group(1), reqMac.group(2))
493+
macosversion = f"{reqMac.group(1)}.{reqMac.group(2)}"
496494
if (
497495
dversion == 7
498496
and macosversion >= "10.3"
@@ -875,9 +873,7 @@ def resolve(
875873

876874
# Mapping of requirement to set of distributions that required it;
877875
# useful for reporting info about conflicts.
878-
required_by: collections.defaultdict[Requirement, set[str]] = (
879-
collections.defaultdict(set)
880-
)
876+
required_by = collections.defaultdict[Requirement, set[str]](set)
881877

882878
while requirements:
883879
# process dependencies breadth-first
@@ -1316,7 +1312,7 @@ def __iadd__(self, other: Distribution | Environment) -> Self:
13161312
for dist in other[project]:
13171313
self.add(dist)
13181314
else:
1319-
raise TypeError("Can't add %r to environment" % (other,))
1315+
raise TypeError(f"Can't add {other!r} to environment")
13201316
return self
13211317

13221318
def __add__(self, other: Distribution | Environment) -> Self:
@@ -1699,7 +1695,7 @@ def get_metadata(self, name: str) -> str:
16991695
except UnicodeDecodeError as exc:
17001696
# Include the path in the error message to simplify
17011697
# troubleshooting, and without changing the exception type.
1702-
exc.reason += ' in {} file at path: {}'.format(name, path)
1698+
exc.reason += f' in {name} file at path: {path}'
17031699
raise
17041700

17051701
def get_metadata_lines(self, name: str) -> Iterator[str]:
@@ -2018,15 +2014,15 @@ def _zipinfo_name(self, fspath):
20182014
return ''
20192015
if fspath.startswith(self.zip_pre):
20202016
return fspath[len(self.zip_pre) :]
2021-
raise AssertionError("%s is not a subpath of %s" % (fspath, self.zip_pre))
2017+
raise AssertionError(f"{fspath} is not a subpath of {self.zip_pre}")
20222018

20232019
def _parts(self, zip_path):
20242020
# Convert a zipfile subpath into an egg-relative path part list.
20252021
# pseudo-fs path
20262022
fspath = self.zip_pre + zip_path
20272023
if fspath.startswith(self.egg_root + os.sep):
20282024
return fspath[len(self.egg_root) + 1 :].split(os.sep)
2029-
raise AssertionError("%s is not a subpath of %s" % (fspath, self.egg_root))
2025+
raise AssertionError(f"{fspath} is not a subpath of {self.egg_root}")
20302026

20312027
@property
20322028
def zipinfo(self):
@@ -2729,15 +2725,16 @@ def __init__(
27292725
self.dist = dist
27302726

27312727
def __str__(self) -> str:
2732-
s = "%s = %s" % (self.name, self.module_name)
2728+
s = f"{self.name} = {self.module_name}"
27332729
if self.attrs:
27342730
s += ':' + '.'.join(self.attrs)
27352731
if self.extras:
2736-
s += ' [%s]' % ','.join(self.extras)
2732+
extras = ','.join(self.extras)
2733+
s += f' [{extras}]'
27372734
return s
27382735

27392736
def __repr__(self) -> str:
2740-
return "EntryPoint.parse(%r)" % str(self)
2737+
return f"EntryPoint.parse({str(self)!r})"
27412738

27422739
@overload
27432740
def load(
@@ -3049,9 +3046,7 @@ def version(self):
30493046
version = self._get_version()
30503047
if version is None:
30513048
path = self._get_metadata_path_for_display(self.PKG_INFO)
3052-
msg = ("Missing 'Version:' header and/or {} file at path: {}").format(
3053-
self.PKG_INFO, path
3054-
)
3049+
msg = f"Missing 'Version:' header and/or {self.PKG_INFO} file at path: {path}"
30553050
raise ValueError(msg, self) from e
30563051

30573052
return version
@@ -3107,9 +3102,7 @@ def requires(self, extras: Iterable[str] = ()) -> list[Requirement]:
31073102
try:
31083103
deps.extend(dm[safe_extra(ext)])
31093104
except KeyError as e:
3110-
raise UnknownExtra(
3111-
"%s has no such extra feature %r" % (self, ext)
3112-
) from e
3105+
raise UnknownExtra(f"{self} has no such extra feature {ext!r}") from e
31133106
return deps
31143107

31153108
def _get_metadata_path_for_display(self, name):
@@ -3150,19 +3143,15 @@ def activate(self, path: list[str] | None = None, replace: bool = False) -> None
31503143

31513144
def egg_name(self):
31523145
"""Return what this distribution's standard .egg filename should be"""
3153-
filename = "%s-%s-py%s" % (
3154-
to_filename(self.project_name),
3155-
to_filename(self.version),
3156-
self.py_version or PY_MAJOR,
3157-
)
3146+
filename = f"{to_filename(self.project_name)}-{to_filename(self.version)}-py{self.py_version or PY_MAJOR}"
31583147

31593148
if self.platform:
31603149
filename += '-' + self.platform
31613150
return filename
31623151

31633152
def __repr__(self) -> str:
31643153
if self.location:
3165-
return "%s (%s)" % (self, self.location)
3154+
return f"{self} ({self.location})"
31663155
else:
31673156
return str(self)
31683157

@@ -3172,7 +3161,7 @@ def __str__(self) -> str:
31723161
except ValueError:
31733162
version = None
31743163
version = version or "[unknown version]"
3175-
return "%s %s" % (self.project_name, version)
3164+
return f"{self.project_name} {version}"
31763165

31773166
def __getattr__(self, attr: str):
31783167
"""Delegate all unrecognized public attributes to .metadata provider"""
@@ -3200,17 +3189,17 @@ def from_filename(
32003189
def as_requirement(self):
32013190
"""Return a ``Requirement`` that matches this distribution exactly"""
32023191
if isinstance(self.parsed_version, packaging.version.Version):
3203-
spec = "%s==%s" % (self.project_name, self.parsed_version)
3192+
spec = f"{self.project_name}=={self.parsed_version}"
32043193
else:
3205-
spec = "%s===%s" % (self.project_name, self.parsed_version)
3194+
spec = f"{self.project_name}==={self.parsed_version}"
32063195

32073196
return Requirement.parse(spec)
32083197

32093198
def load_entry_point(self, group: str, name: str) -> _ResolvedEntryPoint:
32103199
"""Return the `name` entry point of `group` or raise ImportError"""
32113200
ep = self.get_entry_info(group, name)
32123201
if ep is None:
3213-
raise ImportError("Entry point %r not found" % ((group, name),))
3202+
raise ImportError(f"Entry point {(group, name)!r} not found")
32143203
return ep.load()
32153204

32163205
@overload
@@ -3327,8 +3316,8 @@ def check_version_conflict(self):
33273316
):
33283317
continue
33293318
issue_warning(
3330-
"Module %s was already imported from %s, but %s is being added"
3331-
" to sys.path" % (modname, fn, self.location),
3319+
f"Module {modname} was already imported from {fn}, "
3320+
f"but {self.location} is being added to sys.path",
33323321
)
33333322

33343323
def has_version(self) -> bool:
@@ -3512,7 +3501,7 @@ def __hash__(self) -> int:
35123501
return self.__hash
35133502

35143503
def __repr__(self) -> str:
3515-
return "Requirement.parse(%r)" % str(self)
3504+
return f"Requirement.parse({str(self)!r})"
35163505

35173506
@staticmethod
35183507
def parse(s: str | Iterable[str]) -> Requirement:

pkg_resources/tests/test_pkg_resources.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ def test_get_metadata__bad_utf8(tmpdir):
214214
"codec can't decode byte 0xe9 in position 1: "
215215
'invalid continuation byte in METADATA file at path: '
216216
)
217-
assert expected in actual, 'actual: {}'.format(actual)
218-
assert actual.endswith(metadata_path), 'actual: {}'.format(actual)
217+
assert expected in actual, f'actual: {actual}'
218+
assert actual.endswith(metadata_path), f'actual: {actual}'
219219

220220

221221
def make_distribution_no_version(tmpdir, basename):
@@ -252,11 +252,11 @@ def test_distribution_version_missing(
252252
"""
253253
Test Distribution.version when the "Version" header is missing.
254254
"""
255-
basename = 'foo.{}'.format(suffix)
255+
basename = f'foo.{suffix}'
256256
dist, dist_dir = make_distribution_no_version(tmpdir, basename)
257257

258-
expected_text = ("Missing 'Version:' header and/or {} file at path: ").format(
259-
expected_filename
258+
expected_text = (
259+
f"Missing 'Version:' header and/or {expected_filename} file at path: "
260260
)
261261
metadata_path = os.path.join(dist_dir, expected_filename)
262262

pkg_resources/tests/test_working_set.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,13 @@ def parametrize_test_working_set_resolve(*test_list):
104104
)
105105
)
106106
return pytest.mark.parametrize(
107-
'installed_dists,installable_dists,'
108-
'requirements,replace_conflicting,'
109-
'resolved_dists_or_exception',
107+
(
108+
"installed_dists",
109+
"installable_dists",
110+
"requirements",
111+
"replace_conflicting",
112+
"resolved_dists_or_exception",
113+
),
110114
argvalues,
111115
ids=idlist,
112116
)

0 commit comments

Comments
 (0)