/
niceSOFT
/
python3-hatchling
Обзор
Документация
Войти
/
niceSOFT
/
python3-hatchling
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/hatch/cli/python/remove.py
36 строк
1 KB
Dimitri Papadopoulos Orfanos
Upgrade Ruff to 0.13.2 (#1890)
28 сен 2025, 21:20
Не верифицирован
28 сен 2025, 21:20
aff6f39
Код
Авторство
О чём код?
from __future__ import annotations from typing import TYPE_CHECKING import click if TYPE_CHECKING: from hatch.cli.application import Application @click.command(short_help="Remove Python distributions") @click.argument("names", required=True, nargs=-1) @click.option("--dir", "-d", "directory", help="The directory in which distributions reside") @click.pass_obj def remove(app: Application, *, names: tuple[str, ...], directory: str | None): """ Remove Python distributions. You may select `all` to remove all installed distributions: \b ``` hatch python remove all ``` """ manager = app.get_python_manager(directory) installed = manager.get_installed() selection = tuple(installed) if "all" in names else names for name in selection: if name not in installed: app.display_warning(f"Distribution is not installed: {name}") continue dist = installed[name] with app.status(f"Removing {name}"): manager.remove(dist)