From 2bb011a22f7beabecf0556927e21d0746e0bf18b Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Sun, 7 Jul 2024 15:56:34 +0100 Subject: [PATCH] Deprecate `pip install --editable` calling `setup.py develop` Deprecates `pip install --editable` falling back to `setup.py develop` when using a setuptools version that does not support PEP 660 (setuptools v63 and older). See: https://peps.python.org/pep-0660/ https://setuptools.pypa.io/en/latest/history.html#v64-0-0 Closes #11457. --- news/11457.removal.rst | 3 +++ src/pip/_internal/req/req_install.py | 15 +++++++++++++++ tests/functional/test_install.py | 7 +++++-- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 news/11457.removal.rst diff --git a/news/11457.removal.rst b/news/11457.removal.rst new file mode 100644 index 00000000000..7af83fde3ce --- /dev/null +++ b/news/11457.removal.rst @@ -0,0 +1,3 @@ +Deprecate ``pip install --editable`` falling back to ``setup.py develop`` +when using a setuptools version that does not support :pep:`660` +(setuptools v63 and older). diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py index 1a35189621a..834bc513356 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -825,6 +825,21 @@ def install( ) 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.0", + issue=11457, + ) if self.config_settings: logger.warning( "--config-settings ignored for legacy editable install of %s. " diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index e82da82eef4..c6b5635f8fe 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -1350,7 +1350,7 @@ def test_install_package_with_prefix( def _test_install_editable_with_prefix( script: PipTestEnvironment, files: Dict[str, str] -) -> None: +) -> TestPipResult: # make a dummy project pkga_path = script.scratch_path / "pkga" pkga_path.mkdir() @@ -1378,6 +1378,8 @@ def _test_install_editable_with_prefix( install_path = script.scratch / site_packages / "pkga.egg-link" result.did_create(install_path) + return result + @pytest.mark.network def test_install_editable_with_target(script: PipTestEnvironment) -> None: @@ -1427,9 +1429,10 @@ def test_install_editable_legacy_with_prefix_setup_cfg( requires = ["setuptools<64", "wheel"] build-backend = "setuptools.build_meta" """ - _test_install_editable_with_prefix( + result = _test_install_editable_with_prefix( script, {"setup.cfg": setup_cfg, "pyproject.toml": pyproject_toml} ) + assert "(setup.py develop) is deprecated" in result.stderr def test_install_package_conflict_prefix_and_user(