Skip to content

Commit 3faa7b0

Browse files
committed
Merge branch 'main' of https://github.com/pypa/setuptools into add-annotations-guidelines
2 parents 3a3244b + 3accd5c commit 3faa7b0

File tree

190 files changed

+6138
-1060
lines changed

Some content is hidden

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

190 files changed

+6138
-1060
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 = 70.1.0
2+
current_version = 70.2.0
33
commit = True
44
tag = True
55

.github/workflows/main.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,6 @@ jobs:
206206
if: hashFiles('coverage.xml') != '' # Rudimentary `file.exists()`
207207
uses: codecov/codecov-action@v4
208208
with:
209-
files: >-
210-
${{ github.workspace }}\coverage.xml
211209
flags: >- # Mark which lines are covered by which envs
212210
CI-GHA,
213211
${{ github.job }},

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ python:
33
install:
44
- path: .
55
extra_requirements:
6-
- docs
6+
- doc
77

88
# required boilerplate readthedocs/readthedocs.org#10401
99
build:

NEWS.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
v70.2.0
2+
=======
3+
4+
Features
5+
--------
6+
7+
- Updated distutils including significant changes to support Cygwin and mingw compilers. (#4444)
8+
9+
10+
Bugfixes
11+
--------
12+
13+
- Fix distribution name normalisation (:pep:`625`) for valid versions that are
14+
not canonical (e.g. ``1.0-2``). (#4434)
15+
16+
17+
v70.1.1
18+
=======
19+
20+
Misc
21+
----
22+
23+
- #4429
24+
25+
126
v70.1.0
227
=======
328

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@
124124
github_repo_url = f'{github_url}/{github_repo_slug}'
125125
github_sponsors_url = f'{github_url}/sponsors'
126126
extlinks = {
127-
'user': (f'{github_sponsors_url}/%s', '@%s'), # noqa: WPS323
128-
'pypi': ('https://pypi.org/project/%s', '%s'), # noqa: WPS323
129-
'wiki': ('https://wikipedia.org/wiki/%s', '%s'), # noqa: WPS323
127+
'user': (f'{github_sponsors_url}/%s', '@%s'),
128+
'pypi': ('https://pypi.org/project/%s', '%s'),
129+
'wiki': ('https://wikipedia.org/wiki/%s', '%s'),
130130
}
131131
extensions += ['sphinx.ext.extlinks']
132132

docs/deprecated/distutils/apiref.rst

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ This module provides the following functions.
361361
are not given.
362362

363363

364-
.. function:: new_compiler(plat=None, compiler=None, verbose=0, dry_run=0, force=0)
364+
.. function:: new_compiler(plat=None, compiler=None, verbose=False, dry_run=False, force=False)
365365

366366
Factory function to generate an instance of some CCompiler subclass for the
367367
supplied platform/compiler combination. *plat* defaults to ``os.name`` (eg.
@@ -383,7 +383,7 @@ This module provides the following functions.
383383
to :command:`build`, :command:`build_ext`, :command:`build_clib`).
384384

385385

386-
.. class:: CCompiler([verbose=0, dry_run=0, force=0])
386+
.. class:: CCompiler([verbose=False, dry_run=False, force=False])
387387

388388
The abstract base class :class:`CCompiler` defines the interface that must be
389389
implemented by real compiler classes. The class also has some utility methods
@@ -517,7 +517,7 @@ This module provides the following functions.
517517
list) to do the job.
518518

519519

520-
.. method:: CCompiler.find_library_file(dirs, lib[, debug=0])
520+
.. method:: CCompiler.find_library_file(dirs, lib[, debug=False])
521521

522522
Search the specified list of directories for a static or shared library file
523523
*lib* and return the full path to that file. If *debug* is true, look for a
@@ -580,7 +580,7 @@ This module provides the following functions.
580580
The following methods invoke stages in the build process.
581581

582582

583-
.. method:: CCompiler.compile(sources[, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None])
583+
.. method:: CCompiler.compile(sources[, output_dir=None, macros=None, include_dirs=None, debug=False, extra_preargs=None, extra_postargs=None, depends=None])
584584

585585
Compile one or more source files. Generates object files (e.g. transforms a
586586
:file:`.c` file to a :file:`.o` file.)
@@ -624,7 +624,7 @@ This module provides the following functions.
624624
Raises :exc:`CompileError` on failure.
625625

626626

627-
.. method:: CCompiler.create_static_lib(objects, output_libname[, output_dir=None, debug=0, target_lang=None])
627+
.. method:: CCompiler.create_static_lib(objects, output_libname[, output_dir=None, debug=False, target_lang=None])
628628

629629
Link a bunch of stuff together to create a static library file. The "bunch of
630630
stuff" consists of the list of object files supplied as *objects*, the extra
@@ -648,7 +648,7 @@ This module provides the following functions.
648648
Raises :exc:`LibError` on failure.
649649

650650

651-
.. method:: CCompiler.link(target_desc, objects, output_filename[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None])
651+
.. method:: CCompiler.link(target_desc, objects, output_filename[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=False, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None])
652652

653653
Link a bunch of stuff together to create an executable or shared library file.
654654

@@ -690,21 +690,21 @@ This module provides the following functions.
690690
Raises :exc:`LinkError` on failure.
691691

692692

693-
.. method:: CCompiler.link_executable(objects, output_progname[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, target_lang=None])
693+
.. method:: CCompiler.link_executable(objects, output_progname[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, debug=False, extra_preargs=None, extra_postargs=None, target_lang=None])
694694

695695
Link an executable. *output_progname* is the name of the file executable, while
696696
*objects* are a list of object filenames to link in. Other arguments are as for
697697
the :meth:`link` method.
698698

699699

700-
.. method:: CCompiler.link_shared_lib(objects, output_libname[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None])
700+
.. method:: CCompiler.link_shared_lib(objects, output_libname[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=False, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None])
701701

702702
Link a shared library. *output_libname* is the name of the output library,
703703
while *objects* is a list of object filenames to link in. Other arguments are
704704
as for the :meth:`link` method.
705705

706706

707-
.. method:: CCompiler.link_shared_object(objects, output_filename[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None])
707+
.. method:: CCompiler.link_shared_object(objects, output_filename[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=False, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None])
708708

709709
Link a shared object. *output_filename* is the name of the shared object that
710710
will be created, while *objects* is a list of object filenames to link in.
@@ -726,28 +726,28 @@ This module provides the following functions.
726726
use by the various concrete subclasses.
727727

728728

729-
.. method:: CCompiler.executable_filename(basename[, strip_dir=0, output_dir=''])
729+
.. method:: CCompiler.executable_filename(basename[, strip_dir=False, output_dir=''])
730730

731731
Returns the filename of the executable for the given *basename*. Typically for
732732
non-Windows platforms this is the same as the basename, while Windows will get
733733
a :file:`.exe` added.
734734

735735

736-
.. method:: CCompiler.library_filename(libname[, lib_type='static', strip_dir=0, output_dir=''])
736+
.. method:: CCompiler.library_filename(libname[, lib_type='static', strip_dir=False, output_dir=''])
737737

738738
Returns the filename for the given library name on the current platform. On Unix
739739
a library with *lib_type* of ``'static'`` will typically be of the form
740740
:file:`liblibname.a`, while a *lib_type* of ``'dynamic'`` will be of the form
741741
:file:`liblibname.so`.
742742

743743

744-
.. method:: CCompiler.object_filenames(source_filenames[, strip_dir=0, output_dir=''])
744+
.. method:: CCompiler.object_filenames(source_filenames[, strip_dir=False, output_dir=''])
745745

746746
Returns the name of the object files for the given source files.
747747
*source_filenames* should be a list of filenames.
748748

749749

750-
.. method:: CCompiler.shared_object_filename(basename[, strip_dir=0, output_dir=''])
750+
.. method:: CCompiler.shared_object_filename(basename[, strip_dir=False, output_dir=''])
751751

752752
Returns the name of a shared object file for the given file name *basename*.
753753

@@ -884,7 +884,7 @@ This module provides a few functions for creating archive files, such as
884884
tarballs or zipfiles.
885885

886886

887-
.. function:: make_archive(base_name, format[, root_dir=None, base_dir=None, verbose=0, dry_run=0])
887+
.. function:: make_archive(base_name, format[, root_dir=None, base_dir=None, verbose=False, dry_run=False])
888888

889889
Create an archive file (eg. ``zip`` or ``tar``). *base_name* is the name of
890890
the file to create, minus any format-specific extension; *format* is the
@@ -900,7 +900,7 @@ tarballs or zipfiles.
900900
Added support for the ``xztar`` format.
901901

902902

903-
.. function:: make_tarball(base_name, base_dir[, compress='gzip', verbose=0, dry_run=0])
903+
.. function:: make_tarball(base_name, base_dir[, compress='gzip', verbose=False, dry_run=False])
904904

905905
'Create an (optional compressed) archive as a tar file from all files in and
906906
under *base_dir*. *compress* must be ``'gzip'`` (the default),
@@ -915,7 +915,7 @@ tarballs or zipfiles.
915915
Added support for the ``xz`` compression.
916916

917917

918-
.. function:: make_zipfile(base_name, base_dir[, verbose=0, dry_run=0])
918+
.. function:: make_zipfile(base_name, base_dir[, verbose=False, dry_run=False])
919919

920920
Create a zip file from all files in and under *base_dir*. The output zip file
921921
will be named *base_name* + :file:`.zip`. Uses either the :mod:`zipfile` Python
@@ -978,7 +978,7 @@ This module provides functions for operating on directories and trees of
978978
directories.
979979

980980

981-
.. function:: mkpath(name[, mode=0o777, verbose=0, dry_run=0])
981+
.. function:: mkpath(name[, mode=0o777, verbose=False, dry_run=False])
982982

983983
Create a directory and any missing ancestor directories. If the directory
984984
already exists (or if *name* is the empty string, which means the current
@@ -989,7 +989,7 @@ directories.
989989
directories actually created.
990990

991991

992-
.. function:: create_tree(base_dir, files[, mode=0o777, verbose=0, dry_run=0])
992+
.. function:: create_tree(base_dir, files[, mode=0o777, verbose=False, dry_run=False])
993993

994994
Create all the empty directories under *base_dir* needed to put *files* there.
995995
*base_dir* is just the name of a directory which doesn't necessarily exist
@@ -999,7 +999,7 @@ directories.
999999
:func:`mkpath`.
10001000

10011001

1002-
.. function:: copy_tree(src, dst[, preserve_mode=1, preserve_times=1, preserve_symlinks=0, update=0, verbose=0, dry_run=0])
1002+
.. function:: copy_tree(src, dst[, preserve_mode=True, preserve_times=True, preserve_symlinks=False, update=False, verbose=False, dry_run=False])
10031003

10041004
Copy an entire directory tree *src* to a new location *dst*. Both *src* and
10051005
*dst* must be directory names. If *src* is not a directory, raise
@@ -1026,7 +1026,7 @@ directories.
10261026
.. versionchanged:: 3.3.1
10271027
NFS files are ignored.
10281028

1029-
.. function:: remove_tree(directory[, verbose=0, dry_run=0])
1029+
.. function:: remove_tree(directory[, verbose=False, dry_run=False])
10301030

10311031
Recursively remove *directory* and all files and directories underneath it. Any
10321032
errors are ignored (apart from being reported to ``sys.stdout`` if *verbose* is
@@ -1043,7 +1043,7 @@ directories.
10431043
This module contains some utility functions for operating on individual files.
10441044

10451045

1046-
.. function:: copy_file(src, dst[, preserve_mode=1, preserve_times=1, update=0, link=None, verbose=0, dry_run=0])
1046+
.. function:: copy_file(src, dst[, preserve_mode=True, preserve_times=True, update=False, link=None, verbose=False, dry_run=False])
10471047

10481048
Copy file *src* to *dst*. If *dst* is a directory, then *src* is copied there
10491049
with the same name; otherwise, it must be a filename. (If the file exists, it
@@ -1216,7 +1216,7 @@ other utility module.
12161216
.. % Should probably be moved into the standard library.
12171217
12181218
1219-
.. function:: execute(func, args[, msg=None, verbose=0, dry_run=0])
1219+
.. function:: execute(func, args[, msg=None, verbose=False, dry_run=False])
12201220

12211221
Perform some action that affects the outside world (for instance, writing to the
12221222
filesystem). Such actions are special because they are disabled by the
@@ -1234,7 +1234,7 @@ other utility module.
12341234
:exc:`ValueError` if *val* is anything else.
12351235

12361236

1237-
.. function:: byte_compile(py_files[, optimize=0, force=0, prefix=None, base_dir=None, verbose=1, dry_run=0, direct=None])
1237+
.. function:: byte_compile(py_files[, optimize=0, force=False, prefix=None, base_dir=None, verbose=True, dry_run=False, direct=None])
12381238

12391239
Byte-compile a collection of Python source files to :file:`.pyc` files in a
12401240
:file:`__pycache__` subdirectory (see :pep:`3147` and :pep:`488`).

docs/deprecated/distutils/configfile.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ configuration file for this distribution:
9696
.. code-block:: ini
9797
9898
[build_ext]
99-
inplace=1
99+
inplace=true
100100
101101
This will affect all builds of this module distribution, whether or not you
102102
explicitly specify :command:`build_ext`. If you include :file:`setup.cfg` in

docs/deprecated/distutils/setupscript.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ search path, though, you can find that directory using the Distutils
274274
:mod:`distutils.sysconfig` module::
275275

276276
from distutils.sysconfig import get_python_inc
277-
incdir = os.path.join(get_python_inc(plat_specific=1), 'Numerical')
277+
incdir = os.path.join(get_python_inc(plat_specific=True), 'Numerical')
278278
setup(...,
279279
Extension(..., include_dirs=[incdir]),
280280
)

docs/userguide/declarative_config.rst

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ Configuring setuptools using ``setup.cfg`` files
1212
call is still required even if your configuration resides in ``setup.cfg``.
1313

1414
``Setuptools`` allows using configuration files (for example, :file:`setup.cfg`)
15-
to define a package’s metadata and other options that are normally supplied
16-
to the ``setup()`` function (declarative config).
15+
to define a package’s metadata and other options (declarative config).
1716

18-
This approach not only allows automation scenarios but also reduces
19-
boilerplate code in some cases.
17+
This approach allows automation scenarios and can reduce boilerplate code.
2018

2119
.. _example-setup-config:
2220

@@ -135,6 +133,24 @@ value associated with ``""`` in the ``package_dir`` dictionary.
135133
Please see :doc:`package discovery </userguide/package_discovery>` for more
136134
details.
137135

136+
Interpolation
137+
=============
138+
139+
Config files are parsed using :mod:`configparser` with
140+
`interpolation <https://docs.python.org/3/library/configparser.html#interpolation-of-values>`_
141+
enabled. As a result, one config value may reference another. This
142+
feature may be used, for example, in defining extras:
143+
144+
.. code-block:: ini
145+
146+
[options.extras_require]
147+
tester =
148+
pytest==3.3.2
149+
pytest-sugar
150+
dev =
151+
pytest-xdist
152+
%(tester)s
153+
138154
Specifying values
139155
=================
140156

pkg_resources/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,7 +2041,7 @@ def _extract_resource(self, manager: ResourceManager, zip_path) -> str: # noqa:
20412041

20422042
if not WRITE_SUPPORT:
20432043
raise OSError(
2044-
'"os.rename" and "os.unlink" are not supported ' 'on this platform'
2044+
'"os.rename" and "os.unlink" are not supported on this platform'
20452045
)
20462046
try:
20472047
if not self.egg_name:
@@ -2808,7 +2808,7 @@ def _parse_extras(cls, extras_spec):
28082808
return ()
28092809
req = Requirement.parse('x' + extras_spec)
28102810
if req.specs:
2811-
raise ValueError()
2811+
raise ValueError
28122812
return req.extras
28132813

28142814
@classmethod

pkg_resources/extern/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ def load_module(self, fullname: str):
4141
"""
4242
root, base, target = fullname.partition(self.root_name + '.')
4343
for prefix in self.search_path:
44+
extant = prefix + target
4445
try:
45-
extant = prefix + target
4646
__import__(extant)
47-
mod = sys.modules[extant]
48-
sys.modules[fullname] = mod
49-
return mod
5047
except ImportError:
51-
pass
48+
continue
49+
mod = sys.modules[extant]
50+
sys.modules[fullname] = mod
51+
return mod
5252
else:
5353
raise ImportError(
5454
"The '{target}' package is required; "

pkg_resources/tests/test_pkg_resources.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def test_setuptools_not_imported(self):
171171
lines = (
172172
'import pkg_resources',
173173
'import sys',
174-
('assert "setuptools" not in sys.modules, ' '"setuptools was imported"'),
174+
('assert "setuptools" not in sys.modules, "setuptools was imported"'),
175175
)
176176
cmd = [sys.executable, '-c', '; '.join(lines)]
177177
subprocess.check_call(cmd)
@@ -299,7 +299,7 @@ def test_distribution_version_missing_undetected_path():
299299

300300
msg, dist = excinfo.value.args
301301
expected = (
302-
"Missing 'Version:' header and/or PKG-INFO file at path: " '[could not detect]'
302+
"Missing 'Version:' header and/or PKG-INFO file at path: [could not detect]"
303303
)
304304
assert msg == expected
305305

pkg_resources/tests/test_resources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def test_marker_evaluation_with_extras(self):
257257
"/foo_dir/Foo-1.2.dist-info",
258258
metadata=Metadata((
259259
"METADATA",
260-
"Provides-Extra: baz\n" "Requires-Dist: quux; extra=='baz'",
260+
"Provides-Extra: baz\nRequires-Dist: quux; extra=='baz'",
261261
)),
262262
)
263263
ad.add(Foo)

0 commit comments

Comments
 (0)