Skip to content

Commit

Permalink
Merge pull request #12830 from edmorley/deprecate-setup-py-develop
Browse files Browse the repository at this point in the history
Deprecate `pip install --editable` calling `setup.py develop`
  • Loading branch information
pradyunsg committed Jul 15, 2024
2 parents 5e8b086 + 2bb011a commit 6576879
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions news/11457.removal.rst
Original file line number Diff line number Diff line change
@@ -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).
15 changes: 15 additions & 0 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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. "
Expand Down
7 changes: 5 additions & 2 deletions tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 6576879

Please sign in to comment.