pip 25.2__py3-none-any.whl → 26.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. pip/__init__.py +1 -1
  2. pip/_internal/__init__.py +0 -0
  3. pip/_internal/build_env.py +265 -8
  4. pip/_internal/cache.py +1 -1
  5. pip/_internal/cli/base_command.py +11 -0
  6. pip/_internal/cli/cmdoptions.py +200 -71
  7. pip/_internal/cli/index_command.py +20 -0
  8. pip/_internal/cli/main.py +11 -6
  9. pip/_internal/cli/main_parser.py +3 -1
  10. pip/_internal/cli/parser.py +96 -36
  11. pip/_internal/cli/progress_bars.py +4 -2
  12. pip/_internal/cli/req_command.py +126 -30
  13. pip/_internal/commands/cache.py +24 -0
  14. pip/_internal/commands/completion.py +2 -1
  15. pip/_internal/commands/download.py +12 -11
  16. pip/_internal/commands/index.py +13 -6
  17. pip/_internal/commands/install.py +55 -43
  18. pip/_internal/commands/list.py +14 -16
  19. pip/_internal/commands/lock.py +19 -14
  20. pip/_internal/commands/wheel.py +13 -23
  21. pip/_internal/configuration.py +1 -2
  22. pip/_internal/distributions/sdist.py +13 -14
  23. pip/_internal/exceptions.py +96 -6
  24. pip/_internal/index/collector.py +2 -3
  25. pip/_internal/index/package_finder.py +87 -21
  26. pip/_internal/locations/__init__.py +1 -2
  27. pip/_internal/locations/_sysconfig.py +4 -1
  28. pip/_internal/metadata/__init__.py +7 -2
  29. pip/_internal/metadata/importlib/_dists.py +8 -2
  30. pip/_internal/models/link.py +18 -14
  31. pip/_internal/models/release_control.py +92 -0
  32. pip/_internal/models/selection_prefs.py +6 -3
  33. pip/_internal/models/wheel.py +5 -66
  34. pip/_internal/network/auth.py +6 -2
  35. pip/_internal/network/cache.py +6 -11
  36. pip/_internal/network/download.py +4 -5
  37. pip/_internal/network/lazy_wheel.py +5 -3
  38. pip/_internal/network/session.py +14 -10
  39. pip/_internal/operations/build/wheel.py +4 -4
  40. pip/_internal/operations/build/wheel_editable.py +4 -4
  41. pip/_internal/operations/install/wheel.py +1 -2
  42. pip/_internal/operations/prepare.py +9 -4
  43. pip/_internal/pyproject.py +2 -61
  44. pip/_internal/req/__init__.py +1 -3
  45. pip/_internal/req/constructors.py +45 -39
  46. pip/_internal/req/pep723.py +41 -0
  47. pip/_internal/req/req_file.py +10 -2
  48. pip/_internal/req/req_install.py +32 -141
  49. pip/_internal/resolution/resolvelib/candidates.py +20 -11
  50. pip/_internal/resolution/resolvelib/factory.py +43 -1
  51. pip/_internal/resolution/resolvelib/provider.py +9 -0
  52. pip/_internal/resolution/resolvelib/reporter.py +21 -8
  53. pip/_internal/resolution/resolvelib/requirements.py +7 -3
  54. pip/_internal/resolution/resolvelib/resolver.py +2 -6
  55. pip/_internal/self_outdated_check.py +17 -16
  56. pip/_internal/utils/datetime.py +18 -0
  57. pip/_internal/utils/filesystem.py +52 -1
  58. pip/_internal/utils/logging.py +34 -2
  59. pip/_internal/utils/misc.py +18 -12
  60. pip/_internal/utils/pylock.py +116 -0
  61. pip/_internal/utils/unpacking.py +26 -1
  62. pip/_internal/vcs/versioncontrol.py +3 -1
  63. pip/_internal/wheel_builder.py +23 -96
  64. pip/_vendor/README.rst +180 -0
  65. pip/_vendor/cachecontrol/LICENSE.txt +13 -0
  66. pip/_vendor/cachecontrol/__init__.py +6 -3
  67. pip/_vendor/cachecontrol/adapter.py +0 -1
  68. pip/_vendor/cachecontrol/controller.py +1 -1
  69. pip/_vendor/cachecontrol/filewrapper.py +3 -1
  70. pip/_vendor/certifi/LICENSE +20 -0
  71. pip/_vendor/certifi/__init__.py +1 -1
  72. pip/_vendor/certifi/cacert.pem +62 -372
  73. pip/_vendor/dependency_groups/LICENSE.txt +9 -0
  74. pip/_vendor/distlib/LICENSE.txt +284 -0
  75. pip/_vendor/distro/LICENSE +202 -0
  76. pip/_vendor/idna/LICENSE.md +31 -0
  77. pip/_vendor/idna/codec.py +1 -1
  78. pip/_vendor/idna/core.py +1 -1
  79. pip/_vendor/idna/idnadata.py +72 -6
  80. pip/_vendor/idna/package_data.py +1 -1
  81. pip/_vendor/idna/uts46data.py +891 -731
  82. pip/_vendor/msgpack/COPYING +14 -0
  83. pip/_vendor/msgpack/__init__.py +2 -2
  84. pip/_vendor/packaging/LICENSE +3 -0
  85. pip/_vendor/packaging/LICENSE.APACHE +177 -0
  86. pip/_vendor/packaging/LICENSE.BSD +23 -0
  87. pip/_vendor/packaging/__init__.py +1 -1
  88. pip/_vendor/packaging/_elffile.py +0 -1
  89. pip/_vendor/packaging/_manylinux.py +36 -36
  90. pip/_vendor/packaging/_musllinux.py +1 -1
  91. pip/_vendor/packaging/_parser.py +22 -10
  92. pip/_vendor/packaging/_structures.py +8 -0
  93. pip/_vendor/packaging/_tokenizer.py +23 -25
  94. pip/_vendor/packaging/licenses/__init__.py +13 -11
  95. pip/_vendor/packaging/licenses/_spdx.py +41 -1
  96. pip/_vendor/packaging/markers.py +64 -38
  97. pip/_vendor/packaging/metadata.py +143 -27
  98. pip/_vendor/packaging/pylock.py +635 -0
  99. pip/_vendor/packaging/requirements.py +5 -10
  100. pip/_vendor/packaging/specifiers.py +219 -170
  101. pip/_vendor/packaging/tags.py +15 -20
  102. pip/_vendor/packaging/utils.py +19 -24
  103. pip/_vendor/packaging/version.py +315 -105
  104. pip/_vendor/pkg_resources/LICENSE +17 -0
  105. pip/_vendor/platformdirs/LICENSE +21 -0
  106. pip/_vendor/platformdirs/api.py +1 -1
  107. pip/_vendor/platformdirs/macos.py +10 -8
  108. pip/_vendor/platformdirs/version.py +16 -3
  109. pip/_vendor/platformdirs/windows.py +7 -1
  110. pip/_vendor/pygments/LICENSE +25 -0
  111. pip/_vendor/pyproject_hooks/LICENSE +21 -0
  112. pip/_vendor/requests/LICENSE +175 -0
  113. pip/_vendor/requests/__version__.py +2 -2
  114. pip/_vendor/requests/adapters.py +17 -40
  115. pip/_vendor/requests/sessions.py +1 -1
  116. pip/_vendor/resolvelib/LICENSE +13 -0
  117. pip/_vendor/resolvelib/__init__.py +1 -1
  118. pip/_vendor/resolvelib/resolvers/abstract.py +3 -3
  119. pip/_vendor/resolvelib/resolvers/resolution.py +5 -0
  120. pip/_vendor/rich/LICENSE +19 -0
  121. pip/_vendor/rich/style.py +7 -11
  122. pip/_vendor/tomli/LICENSE +21 -0
  123. pip/_vendor/tomli/__init__.py +1 -1
  124. pip/_vendor/tomli/_parser.py +28 -21
  125. pip/_vendor/tomli/_re.py +8 -5
  126. pip/_vendor/tomli_w/LICENSE +21 -0
  127. pip/_vendor/truststore/LICENSE +21 -0
  128. pip/_vendor/truststore/__init__.py +1 -1
  129. pip/_vendor/truststore/_api.py +14 -6
  130. pip/_vendor/truststore/_openssl.py +3 -1
  131. pip/_vendor/urllib3/LICENSE.txt +21 -0
  132. pip/_vendor/vendor.txt +11 -11
  133. {pip-25.2.dist-info → pip-26.0.dist-info}/METADATA +10 -11
  134. {pip-25.2.dist-info → pip-26.0.dist-info}/RECORD +158 -139
  135. {pip-25.2.dist-info → pip-26.0.dist-info}/WHEEL +1 -2
  136. pip-26.0.dist-info/entry_points.txt +4 -0
  137. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/AUTHORS.txt +27 -0
  138. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/idna/LICENSE.md +1 -1
  139. pip/_internal/models/pylock.py +0 -188
  140. pip/_internal/operations/build/metadata_legacy.py +0 -73
  141. pip/_internal/operations/build/wheel_legacy.py +0 -119
  142. pip/_internal/operations/install/editable_legacy.py +0 -48
  143. pip/_internal/utils/setuptools_build.py +0 -149
  144. pip-25.2.dist-info/entry_points.txt +0 -3
  145. pip-25.2.dist-info/licenses/src/pip/_vendor/tomli/LICENSE-HEADER +0 -3
  146. pip-25.2.dist-info/top_level.txt +0 -1
  147. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/LICENSE.txt +0 -0
  148. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/cachecontrol/LICENSE.txt +0 -0
  149. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/certifi/LICENSE +0 -0
  150. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/dependency_groups/LICENSE.txt +0 -0
  151. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/distlib/LICENSE.txt +0 -0
  152. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/distro/LICENSE +0 -0
  153. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/msgpack/COPYING +0 -0
  154. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/packaging/LICENSE +0 -0
  155. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/packaging/LICENSE.APACHE +0 -0
  156. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/packaging/LICENSE.BSD +0 -0
  157. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/pkg_resources/LICENSE +0 -0
  158. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/platformdirs/LICENSE +0 -0
  159. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/pygments/LICENSE +0 -0
  160. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/pyproject_hooks/LICENSE +0 -0
  161. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/requests/LICENSE +0 -0
  162. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/resolvelib/LICENSE +0 -0
  163. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/rich/LICENSE +0 -0
  164. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/tomli/LICENSE +0 -0
  165. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/tomli_w/LICENSE +0 -0
  166. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/truststore/LICENSE +0 -0
  167. {pip-25.2.dist-info → pip-26.0.dist-info}/licenses/src/pip/_vendor/urllib3/LICENSE.txt +0 -0
@@ -34,14 +34,13 @@ from pip._internal.exceptions import (
34
34
  InstallWheelBuildError,
35
35
  )
36
36
  from pip._internal.locations import get_scheme
37
- from pip._internal.metadata import get_environment
37
+ from pip._internal.metadata import BaseEnvironment, get_environment
38
38
  from pip._internal.models.installation_report import InstallationReport
39
39
  from pip._internal.operations.build.build_tracker import get_build_tracker
40
40
  from pip._internal.operations.check import ConflictDetails, check_install_conflicts
41
- from pip._internal.req import install_given_reqs
41
+ from pip._internal.req import InstallationResult, install_given_reqs
42
42
  from pip._internal.req.req_install import (
43
43
  InstallRequirement,
44
- check_legacy_setup_py_options,
45
44
  )
46
45
  from pip._internal.utils.compat import WINDOWS
47
46
  from pip._internal.utils.filesystem import test_writable_dir
@@ -59,7 +58,7 @@ from pip._internal.utils.virtualenv import (
59
58
  running_under_virtualenv,
60
59
  virtualenv_no_global,
61
60
  )
62
- from pip._internal.wheel_builder import build, should_build_for_install_command
61
+ from pip._internal.wheel_builder import build
63
62
 
64
63
  logger = getLogger(__name__)
65
64
 
@@ -87,8 +86,9 @@ class InstallCommand(RequirementCommand):
87
86
  def add_options(self) -> None:
88
87
  self.cmd_opts.add_option(cmdoptions.requirements())
89
88
  self.cmd_opts.add_option(cmdoptions.constraints())
89
+ self.cmd_opts.add_option(cmdoptions.build_constraints())
90
+ self.cmd_opts.add_option(cmdoptions.requirements_from_scripts())
90
91
  self.cmd_opts.add_option(cmdoptions.no_deps())
91
- self.cmd_opts.add_option(cmdoptions.pre())
92
92
 
93
93
  self.cmd_opts.add_option(cmdoptions.editable())
94
94
  self.cmd_opts.add_option(
@@ -210,12 +210,10 @@ class InstallCommand(RequirementCommand):
210
210
  self.cmd_opts.add_option(cmdoptions.ignore_requires_python())
211
211
  self.cmd_opts.add_option(cmdoptions.no_build_isolation())
212
212
  self.cmd_opts.add_option(cmdoptions.use_pep517())
213
- self.cmd_opts.add_option(cmdoptions.no_use_pep517())
214
213
  self.cmd_opts.add_option(cmdoptions.check_build_deps())
215
214
  self.cmd_opts.add_option(cmdoptions.override_externally_managed())
216
215
 
217
216
  self.cmd_opts.add_option(cmdoptions.config_settings())
218
- self.cmd_opts.add_option(cmdoptions.global_options())
219
217
 
220
218
  self.cmd_opts.add_option(
221
219
  "--compile",
@@ -246,9 +244,6 @@ class InstallCommand(RequirementCommand):
246
244
  default=True,
247
245
  help="Do not warn about broken dependencies",
248
246
  )
249
- self.cmd_opts.add_option(cmdoptions.no_binary())
250
- self.cmd_opts.add_option(cmdoptions.only_binary())
251
- self.cmd_opts.add_option(cmdoptions.prefer_binary())
252
247
  self.cmd_opts.add_option(cmdoptions.require_hashes())
253
248
  self.cmd_opts.add_option(cmdoptions.progress_bar())
254
249
  self.cmd_opts.add_option(cmdoptions.root_user_action())
@@ -258,7 +253,13 @@ class InstallCommand(RequirementCommand):
258
253
  self.parser,
259
254
  )
260
255
 
256
+ selection_opts = cmdoptions.make_option_group(
257
+ cmdoptions.package_selection_group,
258
+ self.parser,
259
+ )
260
+
261
261
  self.parser.insert_option_group(0, index_opts)
262
+ self.parser.insert_option_group(0, selection_opts)
262
263
  self.parser.insert_option_group(0, self.cmd_opts)
263
264
 
264
265
  self.cmd_opts.add_option(
@@ -303,7 +304,9 @@ class InstallCommand(RequirementCommand):
303
304
  if options.upgrade:
304
305
  upgrade_strategy = options.upgrade_strategy
305
306
 
307
+ cmdoptions.check_build_constraints(options)
306
308
  cmdoptions.check_dist_restriction(options, check_target=True)
309
+ cmdoptions.check_release_control_exclusive(options)
307
310
 
308
311
  logger.verbose("Using %s", get_pip_version())
309
312
  options.use_user_site = decide_user_install(
@@ -334,8 +337,6 @@ class InstallCommand(RequirementCommand):
334
337
  target_temp_dir_path = target_temp_dir.path
335
338
  self.enter_context(target_temp_dir)
336
339
 
337
- global_options = options.global_options or []
338
-
339
340
  session = self.get_default_session(options)
340
341
 
341
342
  target_python = make_target_python(options)
@@ -355,7 +356,6 @@ class InstallCommand(RequirementCommand):
355
356
 
356
357
  try:
357
358
  reqs = self.get_requirements(args, options, finder, session)
358
- check_legacy_setup_py_options(options, reqs)
359
359
 
360
360
  wheel_cache = WheelCache(options.cache_dir)
361
361
 
@@ -384,7 +384,6 @@ class InstallCommand(RequirementCommand):
384
384
  ignore_requires_python=options.ignore_requires_python,
385
385
  force_reinstall=options.force_reinstall,
386
386
  upgrade_strategy=upgrade_strategy,
387
- use_pep517=options.use_pep517,
388
387
  py_version_info=options.python_version,
389
388
  )
390
389
 
@@ -414,6 +413,13 @@ class InstallCommand(RequirementCommand):
414
413
  )
415
414
  return SUCCESS
416
415
 
416
+ # If there is any more preparation to do for the actual installation, do
417
+ # so now. This includes actually downloading the files in the case that
418
+ # we have been using PEP-658 metadata so far.
419
+ preparer.prepare_linked_requirements_more(
420
+ requirement_set.requirements.values()
421
+ )
422
+
417
423
  try:
418
424
  pip_req = requirement_set.get_requirement("pip")
419
425
  except KeyError:
@@ -425,17 +431,13 @@ class InstallCommand(RequirementCommand):
425
431
  protect_pip_from_modification_on_windows(modifying_pip=modifying_pip)
426
432
 
427
433
  reqs_to_build = [
428
- r
429
- for r in requirement_set.requirements_to_install
430
- if should_build_for_install_command(r)
434
+ r for r in requirement_set.requirements_to_install if not r.is_wheel
431
435
  ]
432
436
 
433
437
  _, build_failures = build(
434
438
  reqs_to_build,
435
439
  wheel_cache=wheel_cache,
436
440
  verify=True,
437
- build_options=[],
438
- global_options=global_options,
439
441
  )
440
442
 
441
443
  if build_failures:
@@ -459,7 +461,6 @@ class InstallCommand(RequirementCommand):
459
461
 
460
462
  installed = install_given_reqs(
461
463
  to_install,
462
- global_options,
463
464
  root=options.root_path,
464
465
  home=target_temp_dir_path,
465
466
  prefix=options.prefix_path,
@@ -478,34 +479,13 @@ class InstallCommand(RequirementCommand):
478
479
  )
479
480
  env = get_environment(lib_locations)
480
481
 
481
- # Display a summary of installed packages, with extra care to
482
- # display a package name as it was requested by the user.
483
- installed.sort(key=operator.attrgetter("name"))
484
- summary = []
485
- installed_versions = {}
486
- for distribution in env.iter_all_distributions():
487
- installed_versions[distribution.canonical_name] = distribution.version
488
- for package in installed:
489
- display_name = package.name
490
- version = installed_versions.get(canonicalize_name(display_name), None)
491
- if version:
492
- text = f"{display_name}-{version}"
493
- else:
494
- text = display_name
495
- summary.append(text)
496
-
497
482
  if conflicts is not None:
498
483
  self._warn_about_conflicts(
499
484
  conflicts,
500
485
  resolver_variant=self.determine_resolver_variant(options),
501
486
  )
502
-
503
- installed_desc = " ".join(summary)
504
- if installed_desc:
505
- write_output(
506
- "Successfully installed %s",
507
- installed_desc,
508
- )
487
+ if summary := installed_packages_summary(installed, env):
488
+ write_output(summary)
509
489
  except OSError as error:
510
490
  show_traceback = self.verbosity >= 1
511
491
 
@@ -644,6 +624,30 @@ class InstallCommand(RequirementCommand):
644
624
  logger.critical("\n".join(parts))
645
625
 
646
626
 
627
+ def installed_packages_summary(
628
+ installed: list[InstallationResult], env: BaseEnvironment
629
+ ) -> str:
630
+ # Format a summary of installed packages, with extra care to
631
+ # display a package name as it was requested by the user.
632
+ installed.sort(key=operator.attrgetter("name"))
633
+ summary = []
634
+ installed_versions = {}
635
+ for distribution in env.iter_all_distributions():
636
+ installed_versions[distribution.canonical_name] = distribution.version
637
+ for package in installed:
638
+ display_name = package.name
639
+ version = installed_versions.get(canonicalize_name(display_name), None)
640
+ if version:
641
+ text = f"{display_name}-{version}"
642
+ else:
643
+ text = display_name
644
+ summary.append(text)
645
+
646
+ if not summary:
647
+ return ""
648
+ return f"Successfully installed {' '.join(summary)}"
649
+
650
+
647
651
  def get_lib_location_guesses(
648
652
  user: bool = False,
649
653
  home: str | None = None,
@@ -690,6 +694,7 @@ def decide_user_install(
690
694
  logger.debug("Non-user install by explicit request")
691
695
  return False
692
696
 
697
+ # If we have been asked for a user install explicitly, check compatibility.
693
698
  if use_user_site:
694
699
  if prefix_path:
695
700
  raise CommandError(
@@ -701,6 +706,13 @@ def decide_user_install(
701
706
  "Can not perform a '--user' install. User site-packages "
702
707
  "are not visible in this virtualenv."
703
708
  )
709
+ # Catch all remaining cases which honour the site.ENABLE_USER_SITE
710
+ # value, such as a plain Python installation (e.g. no virtualenv).
711
+ if not site.ENABLE_USER_SITE:
712
+ raise InstallationError(
713
+ "Can not perform a '--user' install. User site-packages "
714
+ "are disabled for this Python."
715
+ )
704
716
  logger.debug("User install by explicit request")
705
717
  return True
706
718
 
@@ -90,15 +90,6 @@ class ListCommand(IndexGroupCommand):
90
90
  help="Only output packages installed in user-site.",
91
91
  )
92
92
  self.cmd_opts.add_option(cmdoptions.list_path())
93
- self.cmd_opts.add_option(
94
- "--pre",
95
- action="store_true",
96
- default=False,
97
- help=(
98
- "Include pre-release and development versions. By default, "
99
- "pip only finds stable versions."
100
- ),
101
- )
102
93
 
103
94
  self.cmd_opts.add_option(
104
95
  "--format",
@@ -135,7 +126,13 @@ class ListCommand(IndexGroupCommand):
135
126
  self.cmd_opts.add_option(cmdoptions.list_exclude())
136
127
  index_opts = cmdoptions.make_option_group(cmdoptions.index_group, self.parser)
137
128
 
129
+ selection_opts = cmdoptions.make_option_group(
130
+ cmdoptions.package_selection_group,
131
+ self.parser,
132
+ )
133
+
138
134
  self.parser.insert_option_group(0, index_opts)
135
+ self.parser.insert_option_group(0, selection_opts)
139
136
  self.parser.insert_option_group(0, self.cmd_opts)
140
137
 
141
138
  def handle_pip_version_check(self, options: Values) -> None:
@@ -157,7 +154,7 @@ class ListCommand(IndexGroupCommand):
157
154
  # Pass allow_yanked=False to ignore yanked versions.
158
155
  selection_prefs = SelectionPreferences(
159
156
  allow_yanked=False,
160
- allow_all_prereleases=options.pre,
157
+ release_control=options.release_control,
161
158
  )
162
159
 
163
160
  return PackageFinder.create(
@@ -166,6 +163,8 @@ class ListCommand(IndexGroupCommand):
166
163
  )
167
164
 
168
165
  def run(self, options: Values, args: list[str]) -> int:
166
+ cmdoptions.check_release_control_exclusive(options)
167
+
169
168
  if options.outdated and options.uptodate:
170
169
  raise CommandError("Options --outdated and --uptodate cannot be combined.")
171
170
 
@@ -248,8 +247,7 @@ class ListCommand(IndexGroupCommand):
248
247
  dist: _DistWithLatestInfo,
249
248
  ) -> _DistWithLatestInfo | None:
250
249
  all_candidates = finder.find_all_candidates(dist.canonical_name)
251
- if not options.pre:
252
- # Remove prereleases
250
+ if self.should_exclude_prerelease(options, dist.canonical_name):
253
251
  all_candidates = [
254
252
  candidate
255
253
  for candidate in all_candidates
@@ -341,15 +339,15 @@ def format_for_columns(
341
339
  if has_build_tags:
342
340
  header.append("Build")
343
341
 
342
+ has_editables = any(x.editable for x in pkgs)
343
+ if has_editables:
344
+ header.append("Editable project location")
345
+
344
346
  if options.verbose >= 1:
345
347
  header.append("Location")
346
348
  if options.verbose >= 1:
347
349
  header.append("Installer")
348
350
 
349
- has_editables = any(x.editable for x in pkgs)
350
- if has_editables:
351
- header.append("Editable project location")
352
-
353
351
  data = []
354
352
  for i, proj in enumerate(pkgs):
355
353
  # if we're working on the 'outdated' list, separate out the
@@ -2,6 +2,9 @@ import sys
2
2
  from optparse import Values
3
3
  from pathlib import Path
4
4
 
5
+ from pip._vendor import tomli_w
6
+ from pip._vendor.packaging.pylock import is_valid_pylock_path
7
+
5
8
  from pip._internal.cache import WheelCache
6
9
  from pip._internal.cli import cmdoptions
7
10
  from pip._internal.cli.req_command import (
@@ -9,15 +12,12 @@ from pip._internal.cli.req_command import (
9
12
  with_cleanup,
10
13
  )
11
14
  from pip._internal.cli.status_codes import SUCCESS
12
- from pip._internal.models.pylock import Pylock, is_valid_pylock_file_name
13
15
  from pip._internal.operations.build.build_tracker import get_build_tracker
14
- from pip._internal.req.req_install import (
15
- check_legacy_setup_py_options,
16
- )
17
16
  from pip._internal.utils.logging import getLogger
18
17
  from pip._internal.utils.misc import (
19
18
  get_pip_version,
20
19
  )
20
+ from pip._internal.utils.pylock import pylock_from_install_requirements
21
21
  from pip._internal.utils.temp_dir import TempDirectory
22
22
 
23
23
  logger = getLogger(__name__)
@@ -58,9 +58,10 @@ class LockCommand(RequirementCommand):
58
58
  )
59
59
  )
60
60
  self.cmd_opts.add_option(cmdoptions.requirements())
61
+ self.cmd_opts.add_option(cmdoptions.requirements_from_scripts())
61
62
  self.cmd_opts.add_option(cmdoptions.constraints())
63
+ self.cmd_opts.add_option(cmdoptions.build_constraints())
62
64
  self.cmd_opts.add_option(cmdoptions.no_deps())
63
- self.cmd_opts.add_option(cmdoptions.pre())
64
65
 
65
66
  self.cmd_opts.add_option(cmdoptions.editable())
66
67
 
@@ -69,14 +70,10 @@ class LockCommand(RequirementCommand):
69
70
  self.cmd_opts.add_option(cmdoptions.ignore_requires_python())
70
71
  self.cmd_opts.add_option(cmdoptions.no_build_isolation())
71
72
  self.cmd_opts.add_option(cmdoptions.use_pep517())
72
- self.cmd_opts.add_option(cmdoptions.no_use_pep517())
73
73
  self.cmd_opts.add_option(cmdoptions.check_build_deps())
74
74
 
75
75
  self.cmd_opts.add_option(cmdoptions.config_settings())
76
76
 
77
- self.cmd_opts.add_option(cmdoptions.no_binary())
78
- self.cmd_opts.add_option(cmdoptions.only_binary())
79
- self.cmd_opts.add_option(cmdoptions.prefer_binary())
80
77
  self.cmd_opts.add_option(cmdoptions.require_hashes())
81
78
  self.cmd_opts.add_option(cmdoptions.progress_bar())
82
79
 
@@ -85,7 +82,13 @@ class LockCommand(RequirementCommand):
85
82
  self.parser,
86
83
  )
87
84
 
85
+ selection_opts = cmdoptions.make_option_group(
86
+ cmdoptions.package_selection_group,
87
+ self.parser,
88
+ )
89
+
88
90
  self.parser.insert_option_group(0, index_opts)
91
+ self.parser.insert_option_group(0, selection_opts)
89
92
  self.parser.insert_option_group(0, self.cmd_opts)
90
93
 
91
94
  @with_cleanup
@@ -98,6 +101,9 @@ class LockCommand(RequirementCommand):
98
101
  "without prior warning."
99
102
  )
100
103
 
104
+ cmdoptions.check_build_constraints(options)
105
+ cmdoptions.check_release_control_exclusive(options)
106
+
101
107
  session = self.get_default_session(options)
102
108
 
103
109
  finder = self._build_package_finder(
@@ -114,7 +120,6 @@ class LockCommand(RequirementCommand):
114
120
  )
115
121
 
116
122
  reqs = self.get_requirements(args, options, finder, session)
117
- check_legacy_setup_py_options(options, reqs)
118
123
 
119
124
  wheel_cache = WheelCache(options.cache_dir)
120
125
 
@@ -142,7 +147,6 @@ class LockCommand(RequirementCommand):
142
147
  ignore_installed=True,
143
148
  ignore_requires_python=options.ignore_requires_python,
144
149
  upgrade_strategy="to-satisfy-only",
145
- use_pep517=options.use_pep517,
146
150
  )
147
151
 
148
152
  self.trace_basic_info(finder)
@@ -153,15 +157,16 @@ class LockCommand(RequirementCommand):
153
157
  base_dir = Path.cwd()
154
158
  else:
155
159
  output_file_path = Path(options.output_file)
156
- if not is_valid_pylock_file_name(output_file_path):
160
+ if not is_valid_pylock_path(output_file_path):
157
161
  logger.warning(
158
162
  "%s is not a valid lock file name.",
159
163
  output_file_path,
160
164
  )
161
165
  base_dir = output_file_path.parent
162
- pylock_toml = Pylock.from_install_requirements(
166
+ pylock = pylock_from_install_requirements(
163
167
  requirement_set.requirements.values(), base_dir=base_dir
164
- ).as_toml()
168
+ )
169
+ pylock_toml = tomli_w.dumps(pylock.to_dict())
165
170
  if options.output_file == "-":
166
171
  sys.stdout.write(pylock_toml)
167
172
  else:
@@ -11,7 +11,6 @@ from pip._internal.exceptions import CommandError
11
11
  from pip._internal.operations.build.build_tracker import get_build_tracker
12
12
  from pip._internal.req.req_install import (
13
13
  InstallRequirement,
14
- check_legacy_setup_py_options,
15
14
  )
16
15
  from pip._internal.utils.misc import ensure_dir, normalize_path
17
16
  from pip._internal.utils.temp_dir import TempDirectory
@@ -52,16 +51,14 @@ class WheelCommand(RequirementCommand):
52
51
  "current working directory."
53
52
  ),
54
53
  )
55
- self.cmd_opts.add_option(cmdoptions.no_binary())
56
- self.cmd_opts.add_option(cmdoptions.only_binary())
57
- self.cmd_opts.add_option(cmdoptions.prefer_binary())
58
54
  self.cmd_opts.add_option(cmdoptions.no_build_isolation())
59
55
  self.cmd_opts.add_option(cmdoptions.use_pep517())
60
- self.cmd_opts.add_option(cmdoptions.no_use_pep517())
61
56
  self.cmd_opts.add_option(cmdoptions.check_build_deps())
62
57
  self.cmd_opts.add_option(cmdoptions.constraints())
58
+ self.cmd_opts.add_option(cmdoptions.build_constraints())
63
59
  self.cmd_opts.add_option(cmdoptions.editable())
64
60
  self.cmd_opts.add_option(cmdoptions.requirements())
61
+ self.cmd_opts.add_option(cmdoptions.requirements_from_scripts())
65
62
  self.cmd_opts.add_option(cmdoptions.src())
66
63
  self.cmd_opts.add_option(cmdoptions.ignore_requires_python())
67
64
  self.cmd_opts.add_option(cmdoptions.no_deps())
@@ -76,18 +73,6 @@ class WheelCommand(RequirementCommand):
76
73
  )
77
74
 
78
75
  self.cmd_opts.add_option(cmdoptions.config_settings())
79
- self.cmd_opts.add_option(cmdoptions.build_options())
80
- self.cmd_opts.add_option(cmdoptions.global_options())
81
-
82
- self.cmd_opts.add_option(
83
- "--pre",
84
- action="store_true",
85
- default=False,
86
- help=(
87
- "Include pre-release and development versions. By default, "
88
- "pip only finds stable versions."
89
- ),
90
- )
91
76
 
92
77
  self.cmd_opts.add_option(cmdoptions.require_hashes())
93
78
 
@@ -96,11 +81,20 @@ class WheelCommand(RequirementCommand):
96
81
  self.parser,
97
82
  )
98
83
 
84
+ selection_opts = cmdoptions.make_option_group(
85
+ cmdoptions.package_selection_group,
86
+ self.parser,
87
+ )
88
+
99
89
  self.parser.insert_option_group(0, index_opts)
90
+ self.parser.insert_option_group(0, selection_opts)
100
91
  self.parser.insert_option_group(0, self.cmd_opts)
101
92
 
102
93
  @with_cleanup
103
94
  def run(self, options: Values, args: list[str]) -> int:
95
+ cmdoptions.check_build_constraints(options)
96
+ cmdoptions.check_release_control_exclusive(options)
97
+
104
98
  session = self.get_default_session(options)
105
99
 
106
100
  finder = self._build_package_finder(options, session)
@@ -117,7 +111,6 @@ class WheelCommand(RequirementCommand):
117
111
  )
118
112
 
119
113
  reqs = self.get_requirements(args, options, finder, session)
120
- check_legacy_setup_py_options(options, reqs)
121
114
 
122
115
  wheel_cache = WheelCache(options.cache_dir)
123
116
 
@@ -138,13 +131,14 @@ class WheelCommand(RequirementCommand):
138
131
  options=options,
139
132
  wheel_cache=wheel_cache,
140
133
  ignore_requires_python=options.ignore_requires_python,
141
- use_pep517=options.use_pep517,
142
134
  )
143
135
 
144
136
  self.trace_basic_info(finder)
145
137
 
146
138
  requirement_set = resolver.resolve(reqs, check_supported_wheels=True)
147
139
 
140
+ preparer.prepare_linked_requirements_more(requirement_set.requirements.values())
141
+
148
142
  reqs_to_build: list[InstallRequirement] = []
149
143
  for req in requirement_set.requirements.values():
150
144
  if req.is_wheel:
@@ -152,15 +146,11 @@ class WheelCommand(RequirementCommand):
152
146
  else:
153
147
  reqs_to_build.append(req)
154
148
 
155
- preparer.prepare_linked_requirements_more(requirement_set.requirements.values())
156
-
157
149
  # build wheels
158
150
  build_successes, build_failures = build(
159
151
  reqs_to_build,
160
152
  wheel_cache=wheel_cache,
161
153
  verify=(not options.no_verify),
162
- build_options=options.build_options or [],
163
- global_options=options.global_options or [],
164
154
  )
165
155
  for req in build_successes:
166
156
  assert req.link and req.link.is_wheel
@@ -53,8 +53,7 @@ logger = getLogger(__name__)
53
53
  def _normalize_name(name: str) -> str:
54
54
  """Make a name consistent regardless of source (environment or file)"""
55
55
  name = name.lower().replace("_", "-")
56
- if name.startswith("--"):
57
- name = name[2:] # only prefer long opts
56
+ name = name.removeprefix("--") # only prefer long opts
58
57
  return name
59
58
 
60
59
 
@@ -20,7 +20,7 @@ class SourceDistribution(AbstractDistribution):
20
20
  """Represents a source distribution.
21
21
 
22
22
  The preparation step for these needs metadata for the packages to be
23
- generated, either using PEP 517 or using the legacy `setup.py egg_info`.
23
+ generated.
24
24
  """
25
25
 
26
26
  @property
@@ -38,28 +38,27 @@ class SourceDistribution(AbstractDistribution):
38
38
  build_isolation: bool,
39
39
  check_build_deps: bool,
40
40
  ) -> None:
41
- # Load pyproject.toml, to determine whether PEP 517 is to be used
41
+ # Load pyproject.toml
42
42
  self.req.load_pyproject_toml()
43
43
 
44
44
  # Set up the build isolation, if this requirement should be isolated
45
- should_isolate = self.req.use_pep517 and build_isolation
46
- if should_isolate:
45
+ if build_isolation:
47
46
  # Setup an isolated environment and install the build backend static
48
47
  # requirements in it.
49
48
  self._prepare_build_backend(build_env_installer)
50
- # Check that if the requirement is editable, it either supports PEP 660 or
51
- # has a setup.py or a setup.cfg. This cannot be done earlier because we need
52
- # to setup the build backend to verify it supports build_editable, nor can
53
- # it be done later, because we want to avoid installing build requirements
54
- # needlessly. Doing it here also works around setuptools generating
55
- # UNKNOWN.egg-info when running get_requires_for_build_wheel on a directory
56
- # without setup.py nor setup.cfg.
57
- self.req.isolated_editable_sanity_check()
49
+ # Check that the build backend supports PEP 660. This cannot be done
50
+ # earlier because we need to setup the build backend to verify it
51
+ # supports build_editable, nor can it be done later, because we want
52
+ # to avoid installing build requirements needlessly.
53
+ self.req.editable_sanity_check()
58
54
  # Install the dynamic build requirements.
59
55
  self._install_build_reqs(build_env_installer)
56
+ else:
57
+ # When not using build isolation, we still need to check that
58
+ # the build backend supports PEP 660.
59
+ self.req.editable_sanity_check()
60
60
  # Check if the current environment provides build dependencies
61
- should_check_deps = self.req.use_pep517 and check_build_deps
62
- if should_check_deps:
61
+ if check_build_deps:
63
62
  pyproject_requires = self.req.pyproject_requires
64
63
  assert pyproject_requires is not None
65
64
  conflicting, missing = self.req.build_env.check_requirements(