Skip to content

Commit af7e6ba

Browse files
committed
Merge branch 'main' of https://github.com/pypa/setuptools into Bump-Ruff-and-mypy
2 parents 588237e + 8e4868a commit af7e6ba

Some content is hidden

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

66 files changed

+2696
-1306
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 = 76.0.0
2+
current_version = 78.1.1
33
commit = True
44
tag = True
55

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ env:
2828

2929
# Suppress noisy pip warnings
3030
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
31-
PIP_NO_PYTHON_VERSION_WARNING: 'true'
3231
PIP_NO_WARN_SCRIPT_LOCATION: 'true'
3332

3433
# Ensure tests can sense settings about the environment
@@ -64,7 +63,8 @@ jobs:
6463
python: "3.10"
6564
distutils: stdlib
6665
runs-on: ${{ matrix.platform }}
67-
continue-on-error: ${{ matrix.python == '3.14' }}
66+
continue-on-error: ${{ matrix.python == '3.14' || matrix.python == 'pypy3.10' }}
67+
# XXX: pypy seems to be flaky with unrelated tests in #6345
6868
env:
6969
SETUPTOOLS_USE_DISTUTILS: ${{ matrix.distutils || 'local' }}
7070
timeout-minutes: 75

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

NEWS.rst

Lines changed: 161 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,163 @@
1+
v78.1.1
2+
=======
3+
4+
Bugfixes
5+
--------
6+
7+
- More fully sanitized the filename in PackageIndex._download. (#4946)
8+
9+
10+
v78.1.0
11+
=======
12+
13+
Features
14+
--------
15+
16+
- Restore access to _get_vc_env with a warning. (#4874)
17+
18+
19+
v78.0.2
20+
=======
21+
22+
Bugfixes
23+
--------
24+
25+
- Postponed removals of deprecated dash-separated and uppercase fields in ``setup.cfg``.
26+
All packages with deprecated configurations are advised to move before 2026. (#4911)
27+
28+
29+
v78.0.1
30+
=======
31+
32+
Misc
33+
----
34+
35+
- #4909
36+
37+
38+
v78.0.0
39+
=======
40+
41+
Bugfixes
42+
--------
43+
44+
- Reverted distutils changes that broke the monkey patching of command classes. (#4902)
45+
46+
47+
Deprecations and Removals
48+
-------------------------
49+
50+
- Setuptools no longer accepts options containing uppercase or dash characters in ``setup.cfg``.
51+
Please ensure to write the options in ``setup.cfg`` using the :wiki:`lower_snake_case <Snake_case>` convention
52+
(e.g. ``Name => name``, ``install-requires => install_requires``).
53+
This is a follow-up on deprecations introduced in
54+
`v54.1.0 <https://setuptools.pypa.io/en/latest/history.html#v54-1-0>`_ (see #1608) and
55+
`v54.1.1 <https://setuptools.pypa.io/en/latest/history.html#v54-1-1>`_ (see #2592).
56+
57+
.. note::
58+
This change *does not affect configurations in* ``pyproject.toml``
59+
(which uses the :wiki:`lower-kebab-case <Letter_case#Kebab_case>` convention following the precedent set in :pep:`517`/:pep:`518`). (#4870)
60+
61+
62+
Misc
63+
----
64+
65+
- #4904
66+
67+
68+
v77.0.3
69+
=======
70+
71+
Bugfixes
72+
--------
73+
74+
- Temporarily convert error for license glob patterns containing ``../`` into a deprecation warning
75+
to allow an accomodation period. (#4896)
76+
- Better error messages for ``packaging.licenses`` import errors in environments with ``packaging<24.2``\.
77+
The import statement was also deferred to spare users that are not using
78+
license expressions. (#4898)
79+
- Avoided eagerly raising an exception when ``license-files`` is defined
80+
simultaneously inside and outside of ``pyproject.toml``.
81+
Instead we rely on the existing deprecation error. (#4899)
82+
83+
84+
v77.0.2
85+
=======
86+
87+
Bugfixes
88+
--------
89+
90+
- Restore ``distutils.ccompiler._default_compilers`` -- by :user:`ManiacDC` (#4876)
91+
- Fixed copy pasta in ``msvc.shared_lib_format``\. (#4885)
92+
93+
94+
v77.0.1
95+
=======
96+
97+
Bugfixes
98+
--------
99+
100+
- Manually fix news fragment entries causing CI to crash when building docs. (#4891)
101+
102+
103+
v77.0.0
104+
=======
105+
106+
Features
107+
--------
108+
109+
- Added initial support for license expression (PEP :pep:`639 <639#add-license-expression-field>`). -- by :user:`cdce8p` (#4706)
110+
- Store ``License-File``\s in ``.dist-info/licenses`` subfolder and added support for recursive globs for ``license_files`` (PEP :pep:`639 <639#add-license-expression-field>`). -- by :user:`cdce8p` (#4728)
111+
- Bump core metadata version to ``2.4``\. -- by :user:`cdce8p` (#4830)
112+
- Updated vendored copy of ``wheel`` to ``v0.45.1``\. (#4869)
113+
114+
115+
Deprecations and Removals
116+
-------------------------
117+
118+
- Added initial implementation of :pep:`639`.
119+
Users relying on pre- :pep:`639` implementation details
120+
(like precise license file paths inside ``dist-info`` directory)
121+
may need to adjust their code base to avoid problems.
122+
Deprecations and stronger validation were also introduced (#4829).
123+
- Added exception (or warning) when deprecated license classifiers are used,
124+
according to PEP :pep:`639 <639#deprecate-license-classifiers>`. (#4833)
125+
- Deprecated ``tools.setuptools.license-files`` in favor of ``project.license-files``
126+
and added exception if ``project.license-files`` and ``tools.setuptools.license-files``
127+
are used together. -- by :user:`cdce8p` (#4837)
128+
- Deprecated ``project.license`` as a TOML table in
129+
``pyproject.toml``\. Users are expected to move towards using
130+
``project.license-files`` and/or SPDX expressions (as strings) in
131+
``project.license``\.
132+
See PEP :pep:`639 <639#deprecate-license-key-table-subkeys>`. (#4840)
133+
- Added simple validation for given glob patterns in ``license-files``\:
134+
a warning will be generated if no file is matched.
135+
Invalid glob patterns can raise an exception.
136+
-- thanks :user:`cdce8p` for contributions. (#4838)
137+
138+
139+
Misc
140+
----
141+
142+
- #4734
143+
144+
145+
v76.1.0
146+
=======
147+
148+
Features
149+
--------
150+
151+
- In setuptools.msvc.EnvironmentInfo, now honor the correct paths when on an ARM host. (#4786)
152+
153+
154+
Bugfixes
155+
--------
156+
157+
- Restored implicit distutils.ccompiler import for g-ir-scanner. (#4871)
158+
- Restore ``distutils.ccompiler.compiler_class`` -- by :user:`Avasam` (#4876)
159+
160+
1161
v75.3.2
2162
=======
3163

@@ -1859,7 +2019,7 @@ Changes
18592019

18602020
.. warning::
18612021
Please note that future releases of setuptools will halt the build process
1862-
if a ``pyproject.toml`` file that does not match doc:`the PyPA Specification
2022+
if a ``pyproject.toml`` file that does not match :doc:`the PyPA Specification
18632023
<PyPUG:specifications/section-distribution-metadata>` is given.
18642024
* #3215: Updated ``pyproject.toml`` validation, as generated by ``validate-pyproject==0.6.1``.
18652025
* #3218: Prevented builds from erroring if the project specifies metadata via

docs/userguide/miscellaneous.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ files are included in a source distribution by default:
2424
in ``pyproject.toml`` and/or equivalent in ``setup.cfg``/``setup.py``;
2525
note that if you don't explicitly set this parameter, ``setuptools``
2626
will include any files that match the following glob patterns:
27-
``LICENSE*``, ``LICENCE*``, ``COPYING*``, ``NOTICE*``, ``AUTHORS**``;
27+
``LICEN[CS]E*``, ``COPYING*``, ``NOTICE*``, ``AUTHORS**``;
2828
- ``pyproject.toml``;
2929
- ``setup.cfg``;
3030
- ``setup.py``;

docs/userguide/pyproject_config.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The ``project`` table contains metadata fields as described by the
4949
readme = "README.rst"
5050
requires-python = ">=3.8"
5151
keywords = ["one", "two"]
52-
license = {text = "BSD-3-Clause"}
52+
license = "BSD-3-Clause"
5353
classifiers = [
5454
"Framework :: Django",
5555
"Programming Language :: Python :: 3",
@@ -70,6 +70,14 @@ The ``project`` table contains metadata fields as described by the
7070
# ... other project metadata fields as listed in:
7171
# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
7272
73+
.. important::
74+
Support for
75+
:external+PyPUG:ref:`project.license-files <license-files>`
76+
and SPDX license expressions in
77+
:external+PyPUG:ref:`project.license <license>` (:pep:`639`)
78+
were introduced in version 77.0.0.
79+
80+
7381
.. _setuptools-table:
7482

7583
Setuptools-specific configuration
@@ -99,7 +107,8 @@ Key Value Type (TOML) Notes
99107
See :doc:`/userguide/datafiles`.
100108
``exclude-package-data`` table/inline-table Empty by default. See :doc:`/userguide/datafiles`.
101109
------------------------- --------------------------- -------------------------
102-
``license-files`` array of glob patterns **Provisional** - likely to change with :pep:`639`
110+
``license-files`` array of glob patterns **Deprecated** - use ``project.license-files`` instead. See
111+
:external+PyPUG:ref:`Writing your pyproject.toml <license-files>`
103112
(by default: ``['LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*']``)
104113
``data-files`` table/inline-table **Discouraged** - check :doc:`/userguide/datafiles`.
105114
Whenever possible, consider using data files inside the package directories.

newsfragments/4786.feature.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ backend-path = ["."]
55

66
[project]
77
name = "setuptools"
8-
version = "76.0.0"
8+
version = "78.1.1"
99
authors = [
1010
{ name = "Python Packaging Authority", email = "[email protected]" },
1111
]
@@ -14,7 +14,6 @@ readme = "README.rst"
1414
classifiers = [
1515
"Development Status :: 5 - Production/Stable",
1616
"Intended Audience :: Developers",
17-
"License :: OSI Approved :: MIT License",
1817
"Programming Language :: Python :: 3",
1918
"Programming Language :: Python :: 3 :: Only",
2019
"Topic :: Software Development :: Libraries :: Python Modules",
@@ -101,9 +100,7 @@ core = [
101100
"platformdirs >= 4.2.2", # Made ctypes optional (see #4461)
102101

103102
# for distutils
104-
"jaraco.collections",
105103
"jaraco.functools >= 4",
106-
"packaging",
107104
"more_itertools",
108105
]
109106

ruff.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ extend-select = [
1111
"C901", # complex-structure
1212
"I", # isort
1313
"PERF401", # manual-list-comprehension
14-
"W", # pycodestyle Warning
1514

1615
# Ensure modern type annotation syntax and best practices
1716
# Not including those covered by type-checkers or exclusive to Python 3.11+
@@ -54,8 +53,6 @@ ignore = [
5453
"Q003",
5554
"COM812",
5655
"COM819",
57-
"ISC001",
58-
"ISC002",
5956

6057
# local
6158
"PERF203", # try-except-in-loop, micro-optimisation with many false-positive. Worth checking but don't block CI

setuptools/_core_metadata.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
def get_metadata_version(self):
2929
mv = getattr(self, 'metadata_version', None)
3030
if mv is None:
31-
mv = Version('2.2')
31+
mv = Version('2.4')
3232
self.metadata_version = mv
3333
return mv
3434

@@ -88,6 +88,7 @@ def read_pkg_file(self, file):
8888
self.url = _read_field_from_msg(msg, 'home-page')
8989
self.download_url = _read_field_from_msg(msg, 'download-url')
9090
self.license = _read_field_unescaped_from_msg(msg, 'license')
91+
self.license_expression = _read_field_unescaped_from_msg(msg, 'license-expression')
9192

9293
self.long_description = _read_field_unescaped_from_msg(msg, 'description')
9394
if self.long_description is None and self.metadata_version >= Version('2.1'):
@@ -175,8 +176,9 @@ def write_field(key, value):
175176
if attr_val is not None:
176177
write_field(field, attr_val)
177178

178-
license = self.get_license()
179-
if license:
179+
if license_expression := self.license_expression:
180+
write_field('License-Expression', license_expression)
181+
elif license := self.get_license():
180182
write_field('License', rfc822_escape(license))
181183

182184
for label, url in self.project_urls.items():
@@ -205,7 +207,8 @@ def write_field(key, value):
205207
if self.long_description_content_type:
206208
write_field('Description-Content-Type', self.long_description_content_type)
207209

208-
self._write_list(file, 'License-File', self.license_files or [])
210+
safe_license_files = map(_safe_license_file, self.license_files or [])
211+
self._write_list(file, 'License-File', safe_license_files)
209212
_write_requirements(self, file)
210213

211214
for field, attr in _POSSIBLE_DYNAMIC_FIELDS.items():
@@ -291,6 +294,14 @@ def _distribution_fullname(name: str, version: str) -> str:
291294
)
292295

293296

297+
def _safe_license_file(file):
298+
# XXX: Do we need this after the deprecation discussed in #4892, #4896??
299+
normalized = os.path.normpath(file).replace(os.sep, "/")
300+
if "../" in normalized:
301+
return os.path.basename(normalized) # Temporarily restore pre PEP639 behaviour
302+
return normalized
303+
304+
294305
_POSSIBLE_DYNAMIC_FIELDS = {
295306
# Core Metadata Field x related Distribution attribute
296307
"author": "author",
@@ -302,7 +313,12 @@ def _distribution_fullname(name: str, version: str) -> str:
302313
"home-page": "url",
303314
"keywords": "keywords",
304315
"license": "license",
305-
# "license-file": "license_files", # XXX: does PEP 639 exempt Dynamic ??
316+
# XXX: License-File is complicated because the user gives globs that are expanded
317+
# during the build. Without special handling it is likely always
318+
# marked as Dynamic, which is an acceptable outcome according to:
319+
# https://github.com/pypa/setuptools/issues/4629#issuecomment-2331233677
320+
"license-file": "license_files",
321+
"license-expression": "license_expression", # PEP 639
306322
"maintainer": "maintainer",
307323
"maintainer-email": "maintainer_email",
308324
"obsoletes": "obsoletes",

0 commit comments

Comments
 (0)