Skip to content

Commit

Permalink
Deprecate pip install --editable calling setup.py develop
Browse files Browse the repository at this point in the history
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 pypa#11457.
  • Loading branch information
edmorley committed Jul 13, 2024
1 parent c2d706f commit af1cee1
Show file tree
Hide file tree
Showing 3 changed files with 19 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).
11 changes: 11 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,17 @@ 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 af1cee1

Please sign in to comment.