Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
develop.py59 linesDownload Raw Back to command
1import site2import subprocess3import sys4from typing import cast5 6from setuptools import Command7from setuptools.warnings import SetuptoolsDeprecationWarning8 9 10class develop(Command):11    """Set up package for development"""12 13    user_options = [14        ("install-dir=", "d", "install package to DIR"),15        ('no-deps', 'N', "don't install dependencies"),16        ('user', None, f"install in user site-package '{site.USER_SITE}'"),17        ('prefix=', None, "installation prefix"),18        ("index-url=", "i", "base URL of Python Package Index"),19    ]20    boolean_options = [21        'no-deps',22        'user',23    ]24 25    install_dir = None26    no_deps = False27    user = False28    prefix = None29    index_url = None30 31    def run(self) -> None:32        # Casting because mypy doesn't understand bool mult conditionals33        cmd = cast(34            list[str],35            [sys.executable, '-m', 'pip', 'install', '-e', '.', '--use-pep517']36            + ['--target', self.install_dir] * bool(self.install_dir)37            + ['--no-deps'] * self.no_deps38            + ['--user'] * self.user39            + ['--prefix', self.prefix] * bool(self.prefix)40            + ['--index-url', self.index_url] * bool(self.index_url),41        )42        subprocess.check_call(cmd)43 44    def initialize_options(self) -> None:45        DevelopDeprecationWarning.emit()46 47    def finalize_options(self) -> None:48        pass49 50 51class DevelopDeprecationWarning(SetuptoolsDeprecationWarning):52    _SUMMARY = "develop command is deprecated."53    _DETAILS = """54    Please avoid running ``setup.py`` and ``develop``.55    Instead, use standards-based tools like pip or uv.56    """57    _SEE_URL = "https://github.com/pypa/setuptools/issues/917"58    _DUE_DATE = 2025, 10, 3159 
codekingpro/portable-devtools · Team Ai