From 16d95d4cfb77ca22db8cb08a1e68464fd5c1a265 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 | 9 +++++++++ tests/functional/test_install.py | 7 +++++-- 3 files changed, 17 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..5ba96eb2eb7 --- /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 213278588d2..fe242a606a4 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -824,6 +824,15 @@ def install( ) if self.editable and not self.is_wheel: + deprecated( + reason=f"Legacy editable install of {self} is deprecated.", + replacement=( + "to upgrade to a version of setuptools " + "that supports PEP 660 (>= 64)" + ), + 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 0b377167bfe..aa2740c29f0 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -1338,7 +1338,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() @@ -1366,6 +1366,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: @@ -1415,9 +1417,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 "Legacy editable install of simple is deprecated" in result.stderr def test_install_package_conflict_prefix_and_user(