-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathdevelop.py
More file actions
58 lines (48 loc) · 1.71 KB
/
develop.py
File metadata and controls
58 lines (48 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import site
import subprocess
import sys
from typing import cast
from setuptools import Command
from setuptools.warnings import SetuptoolsDeprecationWarning
class develop(Command):
"""Set up package for development"""
user_options = [
("install-dir=", "d", "install package to DIR"),
('no-deps', 'N', "don't install dependencies"),
('user', None, f"install in user site-package '{site.USER_SITE}'"),
('prefix=', None, "installation prefix"),
("index-url=", "i", "base URL of Python Package Index"),
]
boolean_options = [
'no-deps',
'user',
]
install_dir = None
no_deps = False
user = False
prefix = None
index_url = None
def run(self) -> None:
# Casting because mypy doesn't understand bool mult conditionals
cmd = cast(
list[str],
[sys.executable, '-m', 'pip', 'install', '-e', '.', '--use-pep517']
+ ['--target', self.install_dir] * bool(self.install_dir)
+ ['--no-deps'] * self.no_deps
+ ['--user'] * self.user
+ ['--prefix', self.prefix] * bool(self.prefix)
+ ['--index-url', self.index_url] * bool(self.index_url),
)
subprocess.check_call(cmd)
def initialize_options(self) -> None:
DevelopDeprecationWarning.emit()
def finalize_options(self) -> None:
pass
class DevelopDeprecationWarning(SetuptoolsDeprecationWarning):
_SUMMARY = "develop command is deprecated."
_DETAILS = """
Please avoid running ``setup.py`` and ``develop``.
Instead, use standards-based tools like pip or uv.
"""
_SEE_URL = "https://github.com/pypa/setuptools/issues/917"
_DUE_DATE = 2025, 10, 31