Skip to content

Commit 3f83750

Browse files
committed
Merge branch 'main' of https://github.com/pypa/setuptools into runtime-changes-for-typeshed-merge
2 parents 5ee1926 + 0c6f80f commit 3f83750

Some content is hidden

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

68 files changed

+868
-938
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 = 71.1.0
2+
current_version = 72.2.0
33
commit = True
44
tag = True
55

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ recursive-include newsfragments *
1010
include *.py
1111
include *.rst
1212
include MANIFEST.in
13-
include LICENSE
13+
global-include LICEN[CS]E* COPYING* NOTICE* AUTHORS*
1414
include launcher.c
1515
include msvc-build-launcher.cmd
1616
include mypy.ini
1717
include pytest.ini
1818
include tox.ini
1919
include setuptools/tests/config/setupcfg_examples.txt
20+
include setuptools/config/*.schema.json
2021
global-exclude *.py[cod] __pycache__

NEWS.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
v72.2.0
2+
=======
3+
4+
Features
5+
--------
6+
7+
- Merged with pypa/distutils@b7ee725f3 including: Support for Pathlike objects in data files and extensions (pypa/distutils#272, pypa/distutils#237), native support for C++ compilers (pypa/distuils#228) and removed unused get_msvcr() (pypa/distutils#274). (#4538)
8+
9+
10+
v72.1.0
11+
=======
12+
13+
Features
14+
--------
15+
16+
- Restore the tests command and deprecate access to the module. (#4519) (#4520)
17+
18+
19+
v72.0.0
20+
=======
21+
22+
Deprecations and Removals
23+
-------------------------
24+
25+
- The test command has been removed. Users relying on 'setup.py test' will need to migrate to another test runner or pin setuptools before this version. (#931)
26+
27+
128
v71.1.0
229
=======
330

docs/userguide/dependency_management.rst

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,56 @@ Build system requirement
1818
========================
1919

2020
After organizing all the scripts and files and getting ready for packaging,
21-
there needs to be a way to specify what programs and libraries are actually needed
22-
to do the packaging (in our case, ``setuptools`` of course).
23-
This needs to be specified in your ``pyproject.toml`` file
24-
(if you have forgot what this is, go to :doc:`/userguide/quickstart` or :doc:`/build_meta`):
21+
there needs to be a way to specify what programs and libraries (build backend)
22+
are actually needed to build the package for distribution. For Setuptools, the
23+
requisite library is ``setuptools``. Specify the build backend in a
24+
``pyproject.toml`` file (see also :doc:`/userguide/quickstart` or
25+
:doc:`/build_meta`):
2526

2627
.. code-block:: toml
2728
2829
[build-system]
2930
requires = ["setuptools"]
3031
#...
3132
32-
Please note that you should also include here any other ``setuptools`` plugin
33-
(e.g., :pypi:`setuptools-scm`, :pypi:`setuptools-golang`, :pypi:`setuptools-rust`)
33+
Also include any other ``setuptools`` plugins
34+
(e.g., :pypi:`setuptools_scm`, :pypi:`setuptools-golang`, :pypi:`setuptools-rust`)
3435
or build-time dependency (e.g., :pypi:`Cython`, :pypi:`cppy`, :pypi:`pybind11`).
3536

37+
.. code-block:: toml
38+
39+
[build-system]
40+
requires = ["setuptools", "cython", "setuptools_scm"]
41+
42+
43+
If the project depends on a feature introduced in a specific version of Setuptools,
44+
it is good practice to specify it as a lower bound:
45+
46+
.. code-block:: toml
47+
48+
[build-system]
49+
requires = ["setuptools >= 61.2"]
50+
51+
Some may be tempted to also include an upper-bound for yet unreleased major
52+
versions (e.g. ``setuptools <= 70``) or pin to a specific version (e.g.
53+
``setuptools == 70.0.4``) in order to avoid the project being uninstallable
54+
should those backward-incompatible changes affect this release of the project.
55+
Setuptools maintainers recommend strongly against this precautionary approach.
56+
The team primarily maintains one release, the latest monotonically-increasing
57+
release, and encourages users to use that latest release (work at HEAD). As a
58+
result, the team is cognizant of and takes responsibility for making
59+
backward-incompatible changes and aims to mitigate the impact of any breaking
60+
changes prior to releasing that change. By pinning against an unreleased
61+
version, it causes toil (maintenance burden) for each and every project that
62+
does the pinning (and the consumers that use it) and increases the risk of
63+
erosion if maintenance is unsustained. This tradeoff between reproducibility
64+
and compatibility is especially stark because Setuptools frequently releases
65+
backward-incompatible releases for a variety of reasons, many of which won't
66+
affect a given project.
67+
3668
.. note::
3769
In previous versions of ``setuptools``,
38-
this used to be accomplished with the ``setup_requires`` keyword but is
70+
the ``setup_requires`` keyword performed a similar function but is
3971
now considered deprecated in favor of the :pep:`517` style described above.
4072
To peek into how this legacy keyword is used, consult our :doc:`guide on
4173
deprecated practice (WIP) </deprecated/index>`.

docs/userguide/package_discovery.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ exactly to the directory structure, you also need to configure ``package_dir``:
8888
package_dir = {
8989
"mypkg": "lib", # mypkg.module corresponds to lib/module.py
9090
"mypkg.subpkg1": "lib1", # mypkg.subpkg1.module1 corresponds to lib1/module1.py
91-
"mypkg.subpkg2": "lib2" # mypkg.subpkg2.module2 corresponds to lib2/module2.py
91+
"mypkg.subpkg2": "lib2", # mypkg.subpkg2.module2 corresponds to lib2/module2.py
9292
# ...
93+
}
9394
)
9495
9596
.. tab:: pyproject.toml

docs/userguide/quickstart.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Installation
77

88
You can install the latest version of ``setuptools`` using :pypi:`pip`::
99

10-
pip install --upgrade setuptools
10+
pip install --upgrade setuptools[core]
1111

1212
Most of the times, however, you don't have to...
1313

@@ -56,6 +56,16 @@ containing a ``build-system`` section similar to the example below:
5656
This section declares what are your build system dependencies, and which
5757
library will be used to actually do the packaging.
5858

59+
.. note::
60+
61+
Package maintainers might be tempted to use ``setuptools[core]`` as the
62+
requirement, given the guidance above. Avoid doing so, as the extra
63+
is currently considered an internal implementation detail and is likely
64+
to go away in the future and the Setuptools team will not support
65+
compatibility for problems arising from packages published with this
66+
extra declared. Vendored packages will satisfy the dependencies in
67+
the most common isolated build scenarios.
68+
5969
.. note::
6070

6171
Historically this documentation has unnecessarily listed ``wheel``

newsfragments/4534.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Changed the import of ``ctypes.wintypes`` from ``__import__`` to a regular ``import`` statement -- by :user:`Avasam`

newsfragments/4546.misc.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Added lower bound to test dependency on ``wheel`` (0.44.0) to avoid
2+
small inconsistencies in ``Requires-Dist`` normalisation for ``METADATA``.

pkg_resources/__init__.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@
9292
# no write support, probably under GAE
9393
WRITE_SUPPORT = False
9494

95-
import packaging.specifiers
9695
from jaraco.text import (
9796
yield_lines,
9897
drop_comment,
9998
join_continuation,
10099
)
101-
from packaging import markers as _packaging_markers
102-
from packaging import requirements as _packaging_requirements
103-
from packaging import utils as _packaging_utils
104-
from packaging import version as _packaging_version
100+
import packaging.markers
101+
import packaging.requirements
102+
import packaging.specifiers
103+
import packaging.utils
104+
import packaging.version
105105
from platformdirs import user_cache_dir as _user_cache_dir
106106

107107
if TYPE_CHECKING:
@@ -156,7 +156,7 @@ class PEP440Warning(RuntimeWarning):
156156
"""
157157

158158

159-
parse_version = _packaging_version.Version
159+
parse_version = packaging.version.Version
160160

161161
_state_vars: dict[str, str] = {}
162162

@@ -801,7 +801,7 @@ def add(
801801
return
802802

803803
self.by_key[dist.key] = dist
804-
normalized_name = _packaging_utils.canonicalize_name(dist.key)
804+
normalized_name = packaging.utils.canonicalize_name(dist.key)
805805
self.normalized_to_canonical_keys[normalized_name] = dist.key
806806
if dist.key not in keys:
807807
keys.append(dist.key)
@@ -1561,8 +1561,8 @@ def safe_version(version: str) -> str:
15611561
"""
15621562
try:
15631563
# normalize the version
1564-
return str(_packaging_version.Version(version))
1565-
except _packaging_version.InvalidVersion:
1564+
return str(packaging.version.Version(version))
1565+
except packaging.version.InvalidVersion:
15661566
version = version.replace(' ', '.')
15671567
return re.sub('[^A-Za-z0-9.]+', '-', version)
15681568

@@ -1639,9 +1639,9 @@ def evaluate_marker(text: str, extra: str | None = None) -> bool:
16391639
This implementation uses the 'pyparsing' module.
16401640
"""
16411641
try:
1642-
marker = _packaging_markers.Marker(text)
1642+
marker = packaging.markers.Marker(text)
16431643
return marker.evaluate()
1644-
except _packaging_markers.InvalidMarker as e:
1644+
except packaging.markers.InvalidMarker as e:
16451645
raise SyntaxError(e) from e
16461646

16471647

@@ -3001,20 +3001,20 @@ def parsed_version(self):
30013001
if not hasattr(self, "_parsed_version"):
30023002
try:
30033003
self._parsed_version = parse_version(self.version)
3004-
except _packaging_version.InvalidVersion as ex:
3004+
except packaging.version.InvalidVersion as ex:
30053005
info = f"(package: {self.project_name})"
30063006
if hasattr(ex, "add_note"):
30073007
ex.add_note(info) # PEP 678
30083008
raise
3009-
raise _packaging_version.InvalidVersion(f"{str(ex)} {info}") from None
3009+
raise packaging.version.InvalidVersion(f"{str(ex)} {info}") from None
30103010

30113011
return self._parsed_version
30123012

30133013
@property
30143014
def _forgiving_parsed_version(self):
30153015
try:
30163016
return self.parsed_version
3017-
except _packaging_version.InvalidVersion as ex:
3017+
except packaging.version.InvalidVersion as ex:
30183018
self._parsed_version = parse_version(_forgiving_version(self.version))
30193019

30203020
notes = "\n".join(getattr(ex, "__notes__", [])) # PEP 678
@@ -3194,7 +3194,7 @@ def from_filename(
31943194

31953195
def as_requirement(self):
31963196
"""Return a ``Requirement`` that matches this distribution exactly"""
3197-
if isinstance(self.parsed_version, _packaging_version.Version):
3197+
if isinstance(self.parsed_version, packaging.version.Version):
31983198
spec = "%s==%s" % (self.project_name, self.parsed_version)
31993199
else:
32003200
spec = "%s===%s" % (self.project_name, self.parsed_version)
@@ -3452,11 +3452,11 @@ def parse_requirements(strs: _NestedStr) -> map[Requirement]:
34523452
return map(Requirement, join_continuation(map(drop_comment, yield_lines(strs))))
34533453

34543454

3455-
class RequirementParseError(_packaging_requirements.InvalidRequirement):
3455+
class RequirementParseError(packaging.requirements.InvalidRequirement):
34563456
"Compatibility wrapper for InvalidRequirement"
34573457

34583458

3459-
class Requirement(_packaging_requirements.Requirement):
3459+
class Requirement(packaging.requirements.Requirement):
34603460
# prefer variable length tuple to set (as found in
34613461
# packaging.requirements.Requirement)
34623462
extras: tuple[str, ...] # type: ignore[assignment]

pyproject.toml

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

66
[project]
77
name = "setuptools"
8-
version = "71.1.0"
8+
version = "72.2.0"
99
authors = [
1010
{ name = "Python Packaging Authority", email = "[email protected]" },
1111
]
@@ -44,7 +44,7 @@ test = [
4444

4545
# local
4646
"virtualenv>=13.0.0",
47-
"wheel",
47+
"wheel>=0.44.0", # Consistent requirement normalisation in METADATA (see #4547)
4848
"pip>=19.1", # For proper file:// URLs support.
4949
"packaging>=23.2",
5050
"jaraco.envs>=2.2",
@@ -102,6 +102,9 @@ doc = [
102102

103103
# workaround for pypa/setuptools#4333
104104
"pyproject-hooks!=1.1",
105+
106+
# workaround for sphinx-contrib/sphinxcontrib-towncrier#92
107+
"towncrier<24.7",
105108
]
106109
ssl = []
107110
certs = []
@@ -141,7 +144,6 @@ rotate = "setuptools.command.rotate:rotate"
141144
saveopts = "setuptools.command.saveopts:saveopts"
142145
sdist = "setuptools.command.sdist:sdist"
143146
setopt = "setuptools.command.setopt:setopt"
144-
test = "setuptools.command.test:test"
145147
upload_docs = "setuptools.command.upload_docs:upload_docs"
146148

147149
[project.entry-points."setuptools.finalize_distribution_options"]
@@ -153,19 +155,15 @@ eager_resources = "setuptools.dist:assert_string_list"
153155
namespace_packages = "setuptools.dist:check_nsp"
154156
extras_require = "setuptools.dist:check_extras"
155157
install_requires = "setuptools.dist:check_requirements"
156-
tests_require = "setuptools.dist:check_requirements"
157158
setup_requires = "setuptools.dist:check_requirements"
158159
python_requires = "setuptools.dist:check_specifier"
159160
entry_points = "setuptools.dist:check_entry_points"
160-
test_suite = "setuptools.dist:check_test_suite"
161161
zip_safe = "setuptools.dist:assert_bool"
162162
package_data = "setuptools.dist:check_package_data"
163163
exclude_package_data = "setuptools.dist:check_package_data"
164164
include_package_data = "setuptools.dist:assert_bool"
165165
packages = "setuptools.dist:check_packages"
166166
dependency_links = "setuptools.dist:assert_string_list"
167-
test_loader = "setuptools.dist:check_importable"
168-
test_runner = "setuptools.dist:check_importable"
169167
use_2to3 = "setuptools.dist:invalid_unless_false"
170168

171169
[project.entry-points."egg_info.writers"]

0 commit comments

Comments
 (0)