Skip to content

Commit ec33cd0

Browse files
authored
Remove setup.py develop command (#6424)
* Remove setup.py develop command. * Protect from setuptools>=80 incompatibility. * Relocate What's New entry.
1 parent 6d984ae commit ec33cd0

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

benchmarks/asv_delegated.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,24 @@ def _prep_env_override(self, env_parent_dir: Path) -> Path:
4141
# The project checkout.
4242
build_dir = Path(self._build_root) / self._repo_subdir
4343

44+
# Older iterations of setup.py are incompatible with setuptools>=80.
45+
# (Most dependencies are protected by lock-files, but build
46+
# dependencies in pyproject.toml are independent).
47+
setup_py = build_dir / "setup.py"
48+
pyproject = build_dir / "pyproject.toml"
49+
if setup_py.is_file() and "setuptools.command.develop" in setup_py.read_text():
50+
with pyproject.open("r+") as file_write:
51+
lines = file_write.readlines()
52+
for i, line in enumerate(lines):
53+
if line == "requires = [\n":
54+
next_line = lines[i + 1]
55+
indent = next_line[: len(next_line) - len(next_line.lstrip())]
56+
57+
lines.insert(i + 1, f'{indent}"setuptools<80",\n')
58+
break
59+
file_write.seek(0)
60+
file_write.writelines(lines)
61+
4462
class Mode(enum.Enum):
4563
"""The scenarios where the correct env setup script is known."""
4664

docs/src/whatsnew/latest.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ This document explains the changes made to Iris for this release
3636
🐛 Bugs Fixed
3737
=============
3838

39-
#. N/A
39+
#. `@trexfeathers`_ removed the custom ``setup.py develop`` command, since
40+
Setuptools are deprecating ``develop``; developers should instead
41+
use ``pip install -e .``. See `Running setuptools commands`_ for more.
42+
(:pull:`6424`)
4043

4144

4245
💣 Incompatible Changes
@@ -85,4 +88,6 @@ This document explains the changes made to Iris for this release
8588
8689
8790
.. comment
88-
Whatsnew resources in alphabetical order:
91+
Whatsnew resources in alphabetical order:
92+
93+
.. _Running setuptools commands: https://setuptools.pypa.io/en/latest/deprecated/commands.html

setup.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from setuptools import Command, setup
77
from setuptools.command.build_py import build_py
8-
from setuptools.command.develop import develop
98

109

1110
class BaseCommand(Command):
@@ -49,8 +48,7 @@ def finalize_options(self):
4948
cmd.finalize_options(self)
5049

5150
if not hasattr(self, "editable_mode") or self.editable_mode is None:
52-
# Default to editable i.e., applicable to "std_names" and
53-
# and "develop" commands.
51+
# Default to editable i.e., applicable to "std_names".
5452
self.editable_mode = True
5553

5654
def run(self):
@@ -76,7 +74,6 @@ def run(self):
7674

7775

7876
custom_commands = {
79-
"develop": custom_command(develop),
8077
"build_py": custom_command(build_py),
8178
"std_names": custom_command(BaseCommand, help="generate CF standard names"),
8279
}

0 commit comments

Comments
 (0)