Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7a5bf44
Remove setup.py develop code path
sbidoul Mar 8, 2025
ddf43f3
Remove legacy editable tests
sbidoul May 10, 2025
0dad672
Refactor get_created_direct_url test
sbidoul May 18, 2025
817a3ec
Rework PipTestResult for detection of modern editables
sbidoul May 18, 2025
d620b45
Update tests that were looking for egg-link files to detect editables
sbidoul May 10, 2025
6ed6516
Test there is no fallback when backend has no PEP 660
sbidoul Sep 27, 2025
f21c6dc
Update uninstall tests that depend on legacy install methods
sbidoul Sep 27, 2025
68acf27
Update pip show test that depends on legacy install method
sbidoul Sep 27, 2025
a16f46d
Remove non PEP 517 code paths
sbidoul Sep 28, 2025
fbbdbba
Remove --use-pep517 option test
sbidoul Sep 28, 2025
160fb1a
Remove --no-use-pep517 test
sbidoul Sep 28, 2025
fd61e48
Update creation of test package that must fail building
sbidoul Sep 28, 2025
e9f922b
Run unit tests with no build isolation
sbidoul Sep 28, 2025
08fd1e9
Remove tests that exercise --global-option
sbidoul Sep 28, 2025
9eeaa9e
Rework test that needed --global-option to use --config-setting
sbidoul Sep 28, 2025
947ac72
Test install pip without build isolation
sbidoul Sep 28, 2025
469a1e3
Remove legacy 'setup.py clean' tests
sbidoul Sep 28, 2025
4aad48e
Add --no-build-isolation to tests
sbidoul Sep 28, 2025
32ec3f0
Add news
sbidoul Sep 27, 2025
3b2bc9e
Fix and expand PEP 660 detection
sbidoul Sep 28, 2025
aaed08e
Remove a few more obsolete pep517 things from the test suite
sbidoul Sep 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 4 additions & 71 deletions src/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# mypy: strict-optional=False
from __future__ import annotations

import importlib.util
import logging
import os
import pathlib
Expand Down Expand Up @@ -161,8 +160,7 @@ class PipOption(Option):
action="store_true",
default=False,
help=(
"Allow pip to only run in a virtual environment; "
"exit with an error otherwise."
"Allow pip to only run in a virtual environment; exit with an error otherwise."
),
)

Expand Down Expand Up @@ -813,62 +811,16 @@ def _handle_dependency_group(
dest="check_build_deps",
action="store_true",
default=False,
help="Check the build dependencies when PEP517 is used.",
help="Check the build dependencies.",
)


def _handle_no_use_pep517(
option: Option, opt: str, value: str, parser: OptionParser
) -> None:
"""
Process a value provided for the --no-use-pep517 option.

This is an optparse.Option callback for the no_use_pep517 option.
"""
# Since --no-use-pep517 doesn't accept arguments, the value argument
# will be None if --no-use-pep517 is passed via the command-line.
# However, the value can be non-None if the option is triggered e.g.
# by an environment variable, for example "PIP_NO_USE_PEP517=true".
if value is not None:
msg = """A value was passed for --no-use-pep517,
probably using either the PIP_NO_USE_PEP517 environment variable
or the "no-use-pep517" config file option. Use an appropriate value
of the PIP_USE_PEP517 environment variable or the "use-pep517"
config file option instead.
"""
raise_option_error(parser, option=option, msg=msg)

# If user doesn't wish to use pep517, we check if setuptools is installed
# and raise error if it is not.
packages = ("setuptools",)
if not all(importlib.util.find_spec(package) for package in packages):
msg = (
f"It is not possible to use --no-use-pep517 "
f"without {' and '.join(packages)} installed."
)
raise_option_error(parser, option=option, msg=msg)

# Otherwise, --no-use-pep517 was passed via the command-line.
parser.values.use_pep517 = False


use_pep517: Any = partial(
Option,
"--use-pep517",
dest="use_pep517",
action="store_true",
default=None,
help="Use PEP 517 for building source distributions "
"(use --no-use-pep517 to force legacy behaviour).",
)

no_use_pep517: Any = partial(
Option,
"--no-use-pep517",
dest="use_pep517",
action="callback",
callback=_handle_no_use_pep517,
default=None,
default=True,
help=SUPPRESS_HELP,
)

Expand Down Expand Up @@ -901,30 +853,11 @@ def _handle_config_settings(
action="callback",
callback=_handle_config_settings,
metavar="settings",
help="Configuration settings to be passed to the PEP 517 build backend. "
help="Configuration settings to be passed to the build backend. "
"Settings take the form KEY=VALUE. Use multiple --config-settings options "
"to pass multiple keys to the backend.",
)

build_options: Callable[..., Option] = partial(
Option,
"--build-option",
dest="build_options",
metavar="options",
action="append",
help="Extra arguments to be supplied to 'setup.py bdist_wheel'.",
)

global_options: Callable[..., Option] = partial(
Option,
"--global-option",
dest="global_options",
action="append",
metavar="options",
help="Extra global options to be supplied to the setup.py "
"call before the install or bdist_wheel command.",
)

no_clean: Callable[..., Option] = partial(
Option,
"--no-clean",
Expand Down
6 changes: 0 additions & 6 deletions src/pip/_internal/cli/req_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ def make_resolver(
ignore_requires_python: bool = False,
force_reinstall: bool = False,
upgrade_strategy: str = "to-satisfy-only",
use_pep517: bool | None = None,
py_version_info: tuple[int, ...] | None = None,
) -> BaseResolver:
"""
Expand All @@ -172,7 +171,6 @@ def make_resolver(
make_install_req = partial(
install_req_from_req_string,
isolated=options.isolated_mode,
use_pep517=use_pep517,
)
resolver_variant = cls.determine_resolver_variant(options)
# The long import name and duplicated invocation is needed to convince
Expand Down Expand Up @@ -241,7 +239,6 @@ def get_requirements(
req,
comes_from=None,
isolated=options.isolated_mode,
use_pep517=options.use_pep517,
user_supplied=True,
config_settings=getattr(options, "config_settings", None),
)
Expand All @@ -252,7 +249,6 @@ def get_requirements(
req_to_add = install_req_from_req_string(
req,
isolated=options.isolated_mode,
use_pep517=options.use_pep517,
user_supplied=True,
)
requirements.append(req_to_add)
Expand All @@ -262,7 +258,6 @@ def get_requirements(
req,
user_supplied=True,
isolated=options.isolated_mode,
use_pep517=options.use_pep517,
config_settings=getattr(options, "config_settings", None),
)
requirements.append(req_to_add)
Expand All @@ -275,7 +270,6 @@ def get_requirements(
req_to_add = install_req_from_parsed_requirement(
parsed_req,
isolated=options.isolated_mode,
use_pep517=options.use_pep517,
user_supplied=True,
config_settings=(
parsed_req.options.get("config_settings")
Expand Down
5 changes: 0 additions & 5 deletions src/pip/_internal/commands/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
from pip._internal.cli.status_codes import SUCCESS
from pip._internal.operations.build.build_tracker import get_build_tracker
from pip._internal.req.req_install import check_legacy_setup_py_options
from pip._internal.utils.misc import ensure_dir, normalize_path, write_output
from pip._internal.utils.temp_dir import TempDirectory

Expand Down Expand Up @@ -38,7 +37,6 @@ def add_options(self) -> None:
self.cmd_opts.add_option(cmdoptions.constraints())
self.cmd_opts.add_option(cmdoptions.requirements())
self.cmd_opts.add_option(cmdoptions.no_deps())
self.cmd_opts.add_option(cmdoptions.global_options())
self.cmd_opts.add_option(cmdoptions.no_binary())
self.cmd_opts.add_option(cmdoptions.only_binary())
self.cmd_opts.add_option(cmdoptions.prefer_binary())
Expand All @@ -48,7 +46,6 @@ def add_options(self) -> None:
self.cmd_opts.add_option(cmdoptions.progress_bar())
self.cmd_opts.add_option(cmdoptions.no_build_isolation())
self.cmd_opts.add_option(cmdoptions.use_pep517())
self.cmd_opts.add_option(cmdoptions.no_use_pep517())
self.cmd_opts.add_option(cmdoptions.check_build_deps())
self.cmd_opts.add_option(cmdoptions.ignore_requires_python())

Expand Down Expand Up @@ -104,7 +101,6 @@ def run(self, options: Values, args: list[str]) -> int:
)

reqs = self.get_requirements(args, options, finder, session)
check_legacy_setup_py_options(options, reqs)

preparer = self.make_requirement_preparer(
temp_build_dir=directory,
Expand All @@ -122,7 +118,6 @@ def run(self, options: Values, args: list[str]) -> int:
finder=finder,
options=options,
ignore_requires_python=options.ignore_requires_python,
use_pep517=options.use_pep517,
py_version_info=options.python_version,
)

Expand Down
16 changes: 2 additions & 14 deletions src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
from pip._internal.req import install_given_reqs
from pip._internal.req.req_install import (
InstallRequirement,
check_legacy_setup_py_options,
)
from pip._internal.utils.compat import WINDOWS
from pip._internal.utils.filesystem import test_writable_dir
Expand All @@ -59,7 +58,7 @@
running_under_virtualenv,
virtualenv_no_global,
)
from pip._internal.wheel_builder import build, should_build_for_install_command
from pip._internal.wheel_builder import build

logger = getLogger(__name__)

Expand Down Expand Up @@ -210,12 +209,10 @@ def add_options(self) -> None:
self.cmd_opts.add_option(cmdoptions.ignore_requires_python())
self.cmd_opts.add_option(cmdoptions.no_build_isolation())
self.cmd_opts.add_option(cmdoptions.use_pep517())
self.cmd_opts.add_option(cmdoptions.no_use_pep517())
self.cmd_opts.add_option(cmdoptions.check_build_deps())
self.cmd_opts.add_option(cmdoptions.override_externally_managed())

self.cmd_opts.add_option(cmdoptions.config_settings())
self.cmd_opts.add_option(cmdoptions.global_options())

self.cmd_opts.add_option(
"--compile",
Expand Down Expand Up @@ -334,8 +331,6 @@ def run(self, options: Values, args: list[str]) -> int:
target_temp_dir_path = target_temp_dir.path
self.enter_context(target_temp_dir)

global_options = options.global_options or []

session = self.get_default_session(options)

target_python = make_target_python(options)
Expand All @@ -355,7 +350,6 @@ def run(self, options: Values, args: list[str]) -> int:

try:
reqs = self.get_requirements(args, options, finder, session)
check_legacy_setup_py_options(options, reqs)

wheel_cache = WheelCache(options.cache_dir)

Expand Down Expand Up @@ -384,7 +378,6 @@ def run(self, options: Values, args: list[str]) -> int:
ignore_requires_python=options.ignore_requires_python,
force_reinstall=options.force_reinstall,
upgrade_strategy=upgrade_strategy,
use_pep517=options.use_pep517,
py_version_info=options.python_version,
)

Expand Down Expand Up @@ -425,17 +418,13 @@ def run(self, options: Values, args: list[str]) -> int:
protect_pip_from_modification_on_windows(modifying_pip=modifying_pip)

reqs_to_build = [
r
for r in requirement_set.requirements_to_install
if should_build_for_install_command(r)
r for r in requirement_set.requirements_to_install if not r.is_wheel
]

_, build_failures = build(
reqs_to_build,
wheel_cache=wheel_cache,
verify=True,
build_options=[],
global_options=global_options,
)

if build_failures:
Expand All @@ -459,7 +448,6 @@ def run(self, options: Values, args: list[str]) -> int:

installed = install_given_reqs(
to_install,
global_options,
root=options.root_path,
home=target_temp_dir_path,
prefix=options.prefix_path,
Expand Down
6 changes: 0 additions & 6 deletions src/pip/_internal/commands/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
from pip._internal.cli.status_codes import SUCCESS
from pip._internal.models.pylock import Pylock, is_valid_pylock_file_name
from pip._internal.operations.build.build_tracker import get_build_tracker
from pip._internal.req.req_install import (
check_legacy_setup_py_options,
)
from pip._internal.utils.logging import getLogger
from pip._internal.utils.misc import (
get_pip_version,
Expand Down Expand Up @@ -69,7 +66,6 @@ def add_options(self) -> None:
self.cmd_opts.add_option(cmdoptions.ignore_requires_python())
self.cmd_opts.add_option(cmdoptions.no_build_isolation())
self.cmd_opts.add_option(cmdoptions.use_pep517())
self.cmd_opts.add_option(cmdoptions.no_use_pep517())
self.cmd_opts.add_option(cmdoptions.check_build_deps())

self.cmd_opts.add_option(cmdoptions.config_settings())
Expand Down Expand Up @@ -114,7 +110,6 @@ def run(self, options: Values, args: list[str]) -> int:
)

reqs = self.get_requirements(args, options, finder, session)
check_legacy_setup_py_options(options, reqs)

wheel_cache = WheelCache(options.cache_dir)

Expand Down Expand Up @@ -142,7 +137,6 @@ def run(self, options: Values, args: list[str]) -> int:
ignore_installed=True,
ignore_requires_python=options.ignore_requires_python,
upgrade_strategy="to-satisfy-only",
use_pep517=options.use_pep517,
)

self.trace_basic_info(finder)
Expand Down
8 changes: 0 additions & 8 deletions src/pip/_internal/commands/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from pip._internal.operations.build.build_tracker import get_build_tracker
from pip._internal.req.req_install import (
InstallRequirement,
check_legacy_setup_py_options,
)
from pip._internal.utils.misc import ensure_dir, normalize_path
from pip._internal.utils.temp_dir import TempDirectory
Expand Down Expand Up @@ -57,7 +56,6 @@ def add_options(self) -> None:
self.cmd_opts.add_option(cmdoptions.prefer_binary())
self.cmd_opts.add_option(cmdoptions.no_build_isolation())
self.cmd_opts.add_option(cmdoptions.use_pep517())
self.cmd_opts.add_option(cmdoptions.no_use_pep517())
self.cmd_opts.add_option(cmdoptions.check_build_deps())
self.cmd_opts.add_option(cmdoptions.constraints())
self.cmd_opts.add_option(cmdoptions.editable())
Expand All @@ -76,8 +74,6 @@ def add_options(self) -> None:
)

self.cmd_opts.add_option(cmdoptions.config_settings())
self.cmd_opts.add_option(cmdoptions.build_options())
self.cmd_opts.add_option(cmdoptions.global_options())

self.cmd_opts.add_option(
"--pre",
Expand Down Expand Up @@ -117,7 +113,6 @@ def run(self, options: Values, args: list[str]) -> int:
)

reqs = self.get_requirements(args, options, finder, session)
check_legacy_setup_py_options(options, reqs)

wheel_cache = WheelCache(options.cache_dir)

Expand All @@ -138,7 +133,6 @@ def run(self, options: Values, args: list[str]) -> int:
options=options,
wheel_cache=wheel_cache,
ignore_requires_python=options.ignore_requires_python,
use_pep517=options.use_pep517,
)

self.trace_basic_info(finder)
Expand All @@ -159,8 +153,6 @@ def run(self, options: Values, args: list[str]) -> int:
reqs_to_build,
wheel_cache=wheel_cache,
verify=(not options.no_verify),
build_options=options.build_options or [],
global_options=options.global_options or [],
)
for req in build_successes:
assert req.link and req.link.is_wheel
Expand Down
Loading