Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions news/11457.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove support for the legacy ``setup.py develop`` editable method. Pip now
requires setuptools >= 64.
Comment on lines +1 to +2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This news item makes it sound like setuptools is a dependency of pip, maybe something like:

Remove support for the legacy setup.py develop editable method in setuptools editable installs; setuptools >= 64 is now required.

?

6 changes: 2 additions & 4 deletions src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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 @@ -425,9 +425,7 @@ 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(
Expand Down
48 changes: 0 additions & 48 deletions src/pip/_internal/operations/install/editable_legacy.py

This file was deleted.

40 changes: 0 additions & 40 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
from pip._internal.operations.build.metadata_legacy import (
generate_metadata as generate_metadata_legacy,
)
from pip._internal.operations.install.editable_legacy import (
install_editable as install_editable_legacy,
)
from pip._internal.operations.install.wheel import install_wheel
from pip._internal.pyproject import load_pyproject_toml, make_pyproject_path
from pip._internal.req.req_uninstall import UninstallPathSet
Expand Down Expand Up @@ -827,43 +824,6 @@ def install(
prefix=prefix,
)

if self.editable and not self.is_wheel:
deprecated(
reason=(
f"Legacy editable install of {self} (setup.py develop) "
"is deprecated."
),
replacement=(
"to add a pyproject.toml or enable --use-pep517, "
"and use setuptools >= 64. "
"If the resulting installation is not behaving as expected, "
"try using --config-settings editable_mode=compat. "
"Please consult the setuptools documentation for more information"
),
gone_in="25.3",
issue=11457,
)
if self.config_settings:
logger.warning(
"--config-settings ignored for legacy editable install of %s. "
"Consider upgrading to a version of setuptools "
"that supports PEP 660 (>= 64).",
self,
)
install_editable_legacy(
global_options=global_options if global_options is not None else [],
prefix=prefix,
home=home,
use_user_site=use_user_site,
name=self.req.name,
setup_py_path=self.setup_py_path,
isolated=self.isolated,
build_env=self.build_env,
unpacked_source_directory=self.unpacked_source_directory,
)
self.install_succeeded = True
return

assert self.is_wheel
assert self.local_file_path

Expand Down
30 changes: 0 additions & 30 deletions src/pip/_internal/utils/setuptools_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,36 +104,6 @@ def make_setuptools_clean_args(
return args


def make_setuptools_develop_args(
setup_py_path: str,
*,
global_options: Sequence[str],
no_user_config: bool,
prefix: str | None,
home: str | None,
use_user_site: bool,
) -> list[str]:
assert not (use_user_site and prefix)

args = make_setuptools_shim_args(
setup_py_path,
global_options=global_options,
no_user_config=no_user_config,
)

args += ["develop", "--no-deps"]

if prefix:
args += ["--prefix", prefix]
if home is not None:
args += ["--install-dir", home]

if use_user_site:
args += ["--user", "--prefix="]

return args


def make_setuptools_egg_info_args(
setup_py_path: str,
egg_info_dir: str | None,
Expand Down
27 changes: 1 addition & 26 deletions src/pip/_internal/wheel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,37 +43,12 @@ def _contains_egg_info(s: str) -> bool:
return bool(_egg_info_re.search(s))


def _should_build(
req: InstallRequirement,
) -> bool:
"""Return whether an InstallRequirement should be built into a wheel."""
assert not req.constraint

if req.is_wheel:
return False

assert req.source_dir

if req.editable:
# we only build PEP 660 editable requirements
return req.supports_pyproject_editable

return True


def should_build_for_install_command(
req: InstallRequirement,
) -> bool:
return _should_build(req)


def _should_cache(
req: InstallRequirement,
) -> bool | None:
"""
Return whether a built InstallRequirement can be stored in the persistent
wheel cache, assuming the wheel cache is available, and _should_build()
has determined a wheel needs to be built.
wheel cache, assuming the wheel cache is available.
"""
if req.editable or not req.source_dir:
# never cache editable requirements
Expand Down
2 changes: 1 addition & 1 deletion tests/data/packages/SetupPyUTF8/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from distutils.core import setup
from setuptools import setup

setup(
name="SetupPyUTF8",
Expand Down
3 changes: 1 addition & 2 deletions tests/functional/test_freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
need_svn,
wheel,
)
from tests.lib.direct_url import get_created_direct_url_path
from tests.lib.venv import VirtualEnvironment

distribute_re = re.compile("^distribute==[0-9.]+\n", re.MULTILINE)
Expand Down Expand Up @@ -1039,7 +1038,7 @@ def test_freeze_pep610_editable(script: PipTestEnvironment) -> None:
"""
pkg_path = _create_test_package(script.scratch_path, name="testpkg")
result = script.pip("install", pkg_path)
direct_url_path = get_created_direct_url_path(result, "testpkg")
direct_url_path = result.get_created_direct_url_path("testpkg")
assert direct_url_path
# patch direct_url.json to simulate an editable install
with open(direct_url_path) as f:
Expand Down
Loading
Loading