devstuff 2.24.0__py3-none-any.whl → 2.25.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dev_setup/catalog.py +8 -0
- dev_setup/commands/install_cmd.py +20 -9
- dev_setup/commands/list_cmd.py +11 -7
- dev_setup/generic.py +3 -0
- dev_setup/managers.py +281 -0
- dev_setup/tools.yaml +7 -0
- {devstuff-2.24.0.dist-info → devstuff-2.25.0.dist-info}/METADATA +3 -1
- {devstuff-2.24.0.dist-info → devstuff-2.25.0.dist-info}/RECORD +10 -9
- {devstuff-2.24.0.dist-info → devstuff-2.25.0.dist-info}/WHEEL +0 -0
- {devstuff-2.24.0.dist-info → devstuff-2.25.0.dist-info}/entry_points.txt +0 -0
dev_setup/catalog.py
CHANGED
|
@@ -40,6 +40,7 @@ SUPPORTED_FIELDS = {
|
|
|
40
40
|
"sha256",
|
|
41
41
|
"install_script",
|
|
42
42
|
"remove_script",
|
|
43
|
+
"managed_by",
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
|
|
@@ -122,6 +123,13 @@ def validate_catalog(raw: Any, *, source: Path | str = "<catalog>") -> dict[str,
|
|
|
122
123
|
elif not isinstance(requires, list) or not all(isinstance(v, str) for v in requires):
|
|
123
124
|
raise CatalogError(f"{source}: tool {key!r} requires must be a list of strings")
|
|
124
125
|
|
|
126
|
+
managed_by = item.get("managed_by")
|
|
127
|
+
if managed_by is not None:
|
|
128
|
+
if not isinstance(managed_by, str) or not VALID_KEY.match(managed_by):
|
|
129
|
+
raise CatalogError(f"{source}: tool {key!r} managed_by must be a tool key")
|
|
130
|
+
if managed_by == key:
|
|
131
|
+
raise CatalogError(f"{source}: tool {key!r} cannot be managed_by itself")
|
|
132
|
+
|
|
125
133
|
validated[key] = item
|
|
126
134
|
|
|
127
135
|
return validated
|
|
@@ -7,7 +7,7 @@ import click
|
|
|
7
7
|
import questionary
|
|
8
8
|
from rich.markup import escape
|
|
9
9
|
|
|
10
|
-
from dev_setup import registry, ui
|
|
10
|
+
from dev_setup import managers, registry, ui
|
|
11
11
|
from dev_setup.base import Tool
|
|
12
12
|
from dev_setup.commands._plan import plan_for, plan_summary
|
|
13
13
|
|
|
@@ -163,10 +163,16 @@ def _install_interactive(*, yes: bool) -> None:
|
|
|
163
163
|
ui.print_banner()
|
|
164
164
|
tools = registry.all_tools()
|
|
165
165
|
|
|
166
|
-
# Probe installed status concurrently — each check shells out.
|
|
166
|
+
# Probe installed status concurrently — each check shells out. The manager
|
|
167
|
+
# note rides along so its probes share this pass rather than a second one.
|
|
168
|
+
def _probe_one(t: Tool) -> tuple[bool, managers.ManagerNote | None]:
|
|
169
|
+
inst = t.is_installed()
|
|
170
|
+
return inst, managers.note_for(t, inst)
|
|
171
|
+
|
|
167
172
|
with ui.spinner("Checking installed packages..."), ThreadPoolExecutor(max_workers=8) as pool:
|
|
168
|
-
|
|
169
|
-
|
|
173
|
+
probed = dict(zip((t.key for t in tools), pool.map(_probe_one, tools), strict=True))
|
|
174
|
+
installed = {k: v[0] for k, v in probed.items()}
|
|
175
|
+
notes = {k: v[1] for k, v in probed.items()}
|
|
170
176
|
|
|
171
177
|
by_cat: dict[str, list[Tool]] = {}
|
|
172
178
|
for t in tools:
|
|
@@ -186,11 +192,16 @@ def _install_interactive(*, yes: bool) -> None:
|
|
|
186
192
|
for t in entries:
|
|
187
193
|
is_inst = installed[t.key]
|
|
188
194
|
missing = [] if is_inst else registry.missing_requires(t)
|
|
195
|
+
note = notes[t.key]
|
|
196
|
+
suffix, disabled_override = (
|
|
197
|
+
managers.picker_hint(note, t) if note is not None else ("", None)
|
|
198
|
+
)
|
|
189
199
|
desc = t.description
|
|
190
|
-
|
|
191
|
-
|
|
200
|
+
room = max(10, desc_width - len(suffix))
|
|
201
|
+
if len(desc) > room:
|
|
202
|
+
desc = desc[: room - 1] + "…"
|
|
192
203
|
if is_inst:
|
|
193
|
-
disabled = "installed"
|
|
204
|
+
disabled = disabled_override or "installed"
|
|
194
205
|
elif missing:
|
|
195
206
|
disabled = f"requires {', '.join(missing)}"
|
|
196
207
|
else:
|
|
@@ -201,10 +212,10 @@ def _install_interactive(*, yes: bool) -> None:
|
|
|
201
212
|
title: str | list[tuple[str, str]] = (
|
|
202
213
|
[
|
|
203
214
|
("class:check", "● " if is_inst else " "),
|
|
204
|
-
("class:text", f"{t.key:<{key_width}}{desc}"),
|
|
215
|
+
("class:text", f"{t.key:<{key_width}}{desc}{suffix}"),
|
|
205
216
|
]
|
|
206
217
|
if disabled
|
|
207
|
-
else f" {t.key:<{key_width}}{desc}"
|
|
218
|
+
else f" {t.key:<{key_width}}{desc}{suffix}"
|
|
208
219
|
)
|
|
209
220
|
choices.append(questionary.Choice(
|
|
210
221
|
title=title,
|
dev_setup/commands/list_cmd.py
CHANGED
|
@@ -4,17 +4,17 @@ from concurrent.futures import ThreadPoolExecutor
|
|
|
4
4
|
|
|
5
5
|
import click
|
|
6
6
|
|
|
7
|
-
from dev_setup import registry, ui
|
|
7
|
+
from dev_setup import managers, registry, ui
|
|
8
8
|
from dev_setup.base import Tool
|
|
9
9
|
|
|
10
10
|
_MAX_WORKERS = 8
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def _probe(tool: Tool) -> tuple[Tool, bool, str]:
|
|
13
|
+
def _probe(tool: Tool) -> tuple[Tool, bool, str, managers.ManagerNote | None]:
|
|
14
14
|
"""Gather subprocess-heavy status for one tool (runs in a worker thread)."""
|
|
15
15
|
is_inst = tool.is_installed()
|
|
16
16
|
version = tool.get_version() if is_inst else ""
|
|
17
|
-
return tool, is_inst, version
|
|
17
|
+
return tool, is_inst, version, managers.note_for(tool, is_inst)
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
@click.command("list")
|
|
@@ -35,12 +35,12 @@ def list_cmd(show_filter: str, category: str) -> None:
|
|
|
35
35
|
probed = list(pool.map(_probe, tools))
|
|
36
36
|
|
|
37
37
|
by_cat: dict = {}
|
|
38
|
-
for tool, is_inst, version in probed:
|
|
38
|
+
for tool, is_inst, version, note in probed:
|
|
39
39
|
if show_filter == "installed" and not is_inst:
|
|
40
40
|
continue
|
|
41
41
|
if show_filter == "available" and is_inst:
|
|
42
42
|
continue
|
|
43
|
-
by_cat.setdefault(tool.category, []).append((tool, is_inst, version))
|
|
43
|
+
by_cat.setdefault(tool.category, []).append((tool, is_inst, version, note))
|
|
44
44
|
|
|
45
45
|
if not by_cat:
|
|
46
46
|
ui.warn("No packages match the given filters.")
|
|
@@ -52,7 +52,7 @@ def list_cmd(show_filter: str, category: str) -> None:
|
|
|
52
52
|
if not entries:
|
|
53
53
|
continue
|
|
54
54
|
|
|
55
|
-
n_inst = sum(1 for _, is_inst, _ in entries if is_inst)
|
|
55
|
+
n_inst = sum(1 for _, is_inst, _, _ in entries if is_inst)
|
|
56
56
|
tbl = ui.table(
|
|
57
57
|
title=f"[bold]{cat}[/] [{ui.GRAY}]{n_inst}/{len(entries)} installed[/]"
|
|
58
58
|
)
|
|
@@ -62,7 +62,7 @@ def list_cmd(show_filter: str, category: str) -> None:
|
|
|
62
62
|
tbl.add_column("Type", style=ui.CYAN, no_wrap=True)
|
|
63
63
|
tbl.add_column("Version", style=ui.GRAY, no_wrap=True, max_width=28, overflow="ellipsis")
|
|
64
64
|
|
|
65
|
-
for tool, is_inst, version in entries:
|
|
65
|
+
for tool, is_inst, version, note in entries:
|
|
66
66
|
icon = f"[{ui.GREEN}]●[/]" if is_inst else f"[{ui.GRAY}]○[/]"
|
|
67
67
|
desc = tool.description
|
|
68
68
|
if tool.help_cmd:
|
|
@@ -71,6 +71,10 @@ def list_cmd(show_filter: str, category: str) -> None:
|
|
|
71
71
|
missing = registry.missing_requires(tool)
|
|
72
72
|
if missing:
|
|
73
73
|
desc += f"\n[{ui.AMBER}] ⚠ requires: {', '.join(missing)}[/]"
|
|
74
|
+
if note is not None:
|
|
75
|
+
line = managers.list_line(note, tool)
|
|
76
|
+
if line:
|
|
77
|
+
desc += f"\n{line}"
|
|
74
78
|
tbl.add_row(icon, tool.key, desc, tool.install_type, version)
|
|
75
79
|
|
|
76
80
|
ui.console.print(tbl)
|
dev_setup/generic.py
CHANGED
|
@@ -156,6 +156,9 @@ class GenericTool(Tool):
|
|
|
156
156
|
remove_script: str = ""
|
|
157
157
|
help_cmd: str = ""
|
|
158
158
|
docs_url: str = ""
|
|
159
|
+
# Catalog key of the tool that manages this one's installs (uv, nvm, …) when
|
|
160
|
+
# the install type doesn't imply one — see managers.py for what it drives.
|
|
161
|
+
managed_by: str = ""
|
|
159
162
|
requires: list | None = None
|
|
160
163
|
builtin: bool = False
|
|
161
164
|
|
dev_setup/managers.py
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"""Notes about which catalog tool manages — or could manage — another's installs.
|
|
2
|
+
|
|
3
|
+
`list` and the `install` picker annotate a tool with the manager that owns its
|
|
4
|
+
installs: derived from the install type for uvx/pip (uv) and npm (nvm) tools,
|
|
5
|
+
explicit via the `managed_by` field for anything else (python, pi).
|
|
6
|
+
|
|
7
|
+
"Actually managed" is answered two ways, matching how each manager records
|
|
8
|
+
ownership. The *type signal* reuses the probes `outdated` already trusts
|
|
9
|
+
(`uv tool list`, `npm ls -g` inside nvm), so list and outdated agree. The *path
|
|
10
|
+
signal* resolves the tool's executable and asks whether it lives under a root
|
|
11
|
+
the manager reports for itself (`uv tool dir` / `uv python dir`, `$NVM_DIR`) —
|
|
12
|
+
containment via `Path.is_relative_to` on resolved paths, never `startswith`,
|
|
13
|
+
so `uv/python-other` does not read as inside `uv/python`. A probe that cannot
|
|
14
|
+
answer is `unknown`, never silently `managed`: claiming management we did not
|
|
15
|
+
verify is the failure this module exists to prevent.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import json
|
|
21
|
+
import os
|
|
22
|
+
import shlex
|
|
23
|
+
import shutil
|
|
24
|
+
from dataclasses import dataclass
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
from typing import NamedTuple
|
|
27
|
+
|
|
28
|
+
from rich.markup import escape
|
|
29
|
+
|
|
30
|
+
from dev_setup import generic, registry, ui
|
|
31
|
+
from dev_setup.base import Tool
|
|
32
|
+
|
|
33
|
+
# Install types whose tool records are owned by a catalog manager outright —
|
|
34
|
+
# no managed_by field needed.
|
|
35
|
+
AUTO_MANAGER = {"uvx": "uv", "pip": "uv", "npm": "nvm"}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass(frozen=True)
|
|
39
|
+
class ManagerNote:
|
|
40
|
+
manager: str # catalog key, e.g. "uv"
|
|
41
|
+
state: str # "managed" | "outside" | "can-manage" | "system-copy" | "unknown"
|
|
42
|
+
path: str = "" # resolved path, for outside / system-copy (when known)
|
|
43
|
+
executable: str = "" # for system-copy, e.g. "python3"
|
|
44
|
+
why: str = "" # for unknown: the probe's reason
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class _Verdict(NamedTuple):
|
|
48
|
+
managed: bool | None
|
|
49
|
+
why: str = ""
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def manager_of(tool: Tool) -> str | None:
|
|
53
|
+
"""The catalog key managing this tool's installs, or None if none applies.
|
|
54
|
+
|
|
55
|
+
A managed_by typo or a key not in the registry produces no note at all —
|
|
56
|
+
a wrong note is worse than none.
|
|
57
|
+
"""
|
|
58
|
+
mgr = getattr(tool, "managed_by", "") or AUTO_MANAGER.get(tool.install_type, "")
|
|
59
|
+
if not mgr or mgr == tool.key or not registry.exists(mgr):
|
|
60
|
+
return None
|
|
61
|
+
return mgr
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def note_for(tool: Tool, installed: bool) -> ManagerNote | None:
|
|
65
|
+
"""Best-effort probe of who manages this tool's copy. Never raises."""
|
|
66
|
+
try:
|
|
67
|
+
mgr = manager_of(tool)
|
|
68
|
+
if mgr is None:
|
|
69
|
+
return None
|
|
70
|
+
if installed:
|
|
71
|
+
verdict = _is_managed(tool, mgr)
|
|
72
|
+
if verdict.managed is True:
|
|
73
|
+
return ManagerNote(mgr, "managed")
|
|
74
|
+
if verdict.managed is False:
|
|
75
|
+
found = _resolve_executable(tool, mgr)
|
|
76
|
+
return ManagerNote(
|
|
77
|
+
mgr, "outside", path=os.path.realpath(found) if found else ""
|
|
78
|
+
)
|
|
79
|
+
return ManagerNote(mgr, "unknown", why=verdict.why)
|
|
80
|
+
exe = _executable(tool)
|
|
81
|
+
found = shutil.which(exe) if exe else None
|
|
82
|
+
if exe and found:
|
|
83
|
+
return ManagerNote(
|
|
84
|
+
mgr, "system-copy", executable=exe, path=os.path.realpath(found)
|
|
85
|
+
)
|
|
86
|
+
return ManagerNote(mgr, "can-manage")
|
|
87
|
+
except Exception:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _is_managed(tool: Tool, mgr: str) -> _Verdict:
|
|
92
|
+
"""True/False when a probe answered, None plus `why` when it could not."""
|
|
93
|
+
if AUTO_MANAGER.get(tool.install_type) == mgr:
|
|
94
|
+
return _managed_by_type(tool, mgr)
|
|
95
|
+
return _managed_by_path(tool, mgr)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _executable(tool: Tool) -> str:
|
|
99
|
+
"""The binary PATH would name for this tool, or "" when no field provides one."""
|
|
100
|
+
for cand in (getattr(tool, "version_cmd", ""), getattr(tool, "check_cmd", "")):
|
|
101
|
+
if generic._is_simple_command(cand or ""):
|
|
102
|
+
return cand
|
|
103
|
+
return ""
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# -- Type signal ---------------------------------------------------------------
|
|
107
|
+
# The same records `outdated` trusts: uv tools appear in `uv tool list`, nvm's
|
|
108
|
+
# npm packages in `npm ls -g` after sourcing nvm.sh. Membership means managed.
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def _managed_by_type(tool: Tool, mgr: str) -> _Verdict:
|
|
112
|
+
if mgr == "uv":
|
|
113
|
+
answer = generic._uv_tool_versions()
|
|
114
|
+
name = tool.pip_name
|
|
115
|
+
elif mgr == "nvm":
|
|
116
|
+
answer = _nvm_npm_globals()
|
|
117
|
+
name = tool.npm_name
|
|
118
|
+
else:
|
|
119
|
+
return _Verdict(None, f"no way to check what {mgr} manages")
|
|
120
|
+
if answer.data is None:
|
|
121
|
+
if answer.why == f"{mgr} is not installed":
|
|
122
|
+
return _Verdict(False, answer.why)
|
|
123
|
+
return _Verdict(None, answer.why)
|
|
124
|
+
return _Verdict(bool(name) and name in answer.data)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
@generic._once
|
|
128
|
+
def _nvm_npm_globals() -> generic._Answer:
|
|
129
|
+
"""Package name -> version for nvm's global npm installs. One call per process.
|
|
130
|
+
|
|
131
|
+
`npm ls -g` can exit non-zero yet print a valid JSON tree (extraneous or
|
|
132
|
+
problem packages), so stdout is parsed whatever the return code; only
|
|
133
|
+
unparseable output is a failed probe.
|
|
134
|
+
"""
|
|
135
|
+
nvm_dir = _nvm_dir()
|
|
136
|
+
if not (nvm_dir / "nvm.sh").exists():
|
|
137
|
+
return generic._Answer(None, "nvm is not installed")
|
|
138
|
+
try:
|
|
139
|
+
r = generic._probe(
|
|
140
|
+
["bash", "-c", f'. "{nvm_dir}/nvm.sh" >/dev/null 2>&1 && npm ls -g --depth=0 --json'],
|
|
141
|
+
capture_output=True, text=True, timeout=15,
|
|
142
|
+
)
|
|
143
|
+
except Exception:
|
|
144
|
+
return generic._Answer(None, "couldn't list nvm's global npm packages")
|
|
145
|
+
try:
|
|
146
|
+
deps = json.loads(r.stdout or "{}").get("dependencies", {})
|
|
147
|
+
except (json.JSONDecodeError, AttributeError):
|
|
148
|
+
return generic._Answer(None, "couldn't list nvm's global npm packages")
|
|
149
|
+
return generic._Answer(
|
|
150
|
+
{name: (info.get("version", "") if isinstance(info, dict) else "") for name, info in deps.items()}
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
# -- Path signal ---------------------------------------------------------------
|
|
155
|
+
# For explicit managed_by (python, pi): where the resolved executable sits.
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def _managed_by_path(tool: Tool, mgr: str) -> _Verdict:
|
|
159
|
+
exe = _executable(tool)
|
|
160
|
+
if not exe:
|
|
161
|
+
return _Verdict(None, "no executable to check")
|
|
162
|
+
probe = _ROOT_PROBES.get(mgr)
|
|
163
|
+
if probe is None:
|
|
164
|
+
return _Verdict(None, f"no way to check what {mgr} manages")
|
|
165
|
+
answer = probe()
|
|
166
|
+
if answer.data is None:
|
|
167
|
+
return _Verdict(None, answer.why)
|
|
168
|
+
if not answer.data:
|
|
169
|
+
return _Verdict(False) # the manager itself is absent, so it manages nothing
|
|
170
|
+
path = _resolve_executable(tool, mgr)
|
|
171
|
+
if not path:
|
|
172
|
+
return _Verdict(None, f"couldn't find {exe} on PATH")
|
|
173
|
+
real = Path(os.path.realpath(path))
|
|
174
|
+
return _Verdict(any(real.is_relative_to(root) for root in answer.data))
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def _resolve_executable(tool: Tool, mgr: str) -> str:
|
|
178
|
+
"""Where `tool`'s binary resolves, or "". For nvm a direct `which` miss gets a
|
|
179
|
+
second chance through an nvm-sourced shell — the binary may only exist once
|
|
180
|
+
nvm has put its node bin dir on PATH."""
|
|
181
|
+
exe = _executable(tool)
|
|
182
|
+
if not exe:
|
|
183
|
+
return ""
|
|
184
|
+
path = shutil.which(exe)
|
|
185
|
+
if path is None and mgr == "nvm":
|
|
186
|
+
try:
|
|
187
|
+
r = generic._probe(
|
|
188
|
+
["bash", "-c", f'. "{_nvm_dir()}/nvm.sh" 2>/dev/null; command -v {shlex.quote(exe)}'],
|
|
189
|
+
capture_output=True, text=True, timeout=10,
|
|
190
|
+
)
|
|
191
|
+
if r.returncode == 0 and r.stdout.strip():
|
|
192
|
+
path = r.stdout.strip().splitlines()[-1]
|
|
193
|
+
except Exception:
|
|
194
|
+
pass
|
|
195
|
+
return path or ""
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
@generic._once
|
|
199
|
+
def _uv_roots() -> generic._Answer:
|
|
200
|
+
"""Directories uv owns (tool envs, managed pythons), as resolved paths.
|
|
201
|
+
|
|
202
|
+
Empty means "uv is not installed" — a definitive *outside*, distinct from
|
|
203
|
+
a failed probe (None) which is *unknown*.
|
|
204
|
+
"""
|
|
205
|
+
uv = shutil.which("uv")
|
|
206
|
+
if not uv:
|
|
207
|
+
return generic._Answer({})
|
|
208
|
+
roots: dict[str, str] = {}
|
|
209
|
+
for sub in ("tool", "python"):
|
|
210
|
+
try:
|
|
211
|
+
r = generic._probe(
|
|
212
|
+
[uv, sub, "dir"], capture_output=True, text=True, timeout=10
|
|
213
|
+
)
|
|
214
|
+
except Exception:
|
|
215
|
+
return generic._Answer(None, f"couldn't run `uv {sub} dir`")
|
|
216
|
+
if r.returncode != 0 or not r.stdout.strip():
|
|
217
|
+
return generic._Answer(None, f"`uv {sub} dir` failed")
|
|
218
|
+
roots[os.path.realpath(r.stdout.strip().splitlines()[0])] = ""
|
|
219
|
+
return generic._Answer(roots)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
@generic._once
|
|
223
|
+
def _nvm_roots() -> generic._Answer:
|
|
224
|
+
nvm_dir = _nvm_dir()
|
|
225
|
+
if nvm_dir.is_dir():
|
|
226
|
+
return generic._Answer({os.path.realpath(nvm_dir): ""})
|
|
227
|
+
return generic._Answer({})
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def _nvm_dir() -> Path:
|
|
231
|
+
return Path(os.environ.get("NVM_DIR") or Path.home() / ".nvm")
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
_ROOT_PROBES = {"uv": _uv_roots, "nvm": _nvm_roots}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
# -- Rendering -----------------------------------------------------------------
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def list_line(note: ManagerNote, tool: Tool) -> str:
|
|
241
|
+
"""A second description-cell line for `devstuff list`; "" for an unknown state.
|
|
242
|
+
|
|
243
|
+
`outside` carries no `devstuff install` remedy on purpose: install_cmd
|
|
244
|
+
returns early on is_installed(), so that advice would be false. `system-copy`
|
|
245
|
+
can carry it because the tool reads not-installed, so install actually runs.
|
|
246
|
+
"""
|
|
247
|
+
mgr = escape(note.manager)
|
|
248
|
+
if note.state == "managed":
|
|
249
|
+
return f"[{ui.GRAY}] ✓ managed by {mgr}[/]"
|
|
250
|
+
if note.state == "outside":
|
|
251
|
+
path = f" ({escape(note.path)})" if note.path else ""
|
|
252
|
+
return f"[{ui.AMBER}] ⇢ installed outside {mgr}{path}; {mgr} can manage it[/]"
|
|
253
|
+
if note.state == "can-manage":
|
|
254
|
+
return f"[{ui.GRAY}] ⇢ {mgr} can manage this[/]"
|
|
255
|
+
if note.state == "system-copy":
|
|
256
|
+
return (
|
|
257
|
+
f"[{ui.AMBER}] ⇢ {escape(note.executable)} at {escape(note.path)} isn't "
|
|
258
|
+
f"managed by {mgr}; `devstuff install {escape(tool.key)}` lets {mgr} manage it[/]"
|
|
259
|
+
)
|
|
260
|
+
if note.state == "unknown":
|
|
261
|
+
why = f" ({escape(note.why)})" if note.why else ""
|
|
262
|
+
return f"[{ui.GRAY}] ? {mgr}-managed tool; couldn't confirm{why}[/]"
|
|
263
|
+
return ""
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def picker_hint(note: ManagerNote, tool: Tool) -> tuple[str, str | None]:
|
|
267
|
+
"""(title suffix, disabled-text override) for the install picker.
|
|
268
|
+
|
|
269
|
+
Plain text only — picker titles aren't Rich markup, so nothing is escaped.
|
|
270
|
+
`unknown` returns no override: the default "installed" is the honest row.
|
|
271
|
+
"""
|
|
272
|
+
mgr = note.manager
|
|
273
|
+
if note.state == "managed":
|
|
274
|
+
return "", f"installed · managed by {mgr}"
|
|
275
|
+
if note.state == "outside":
|
|
276
|
+
return "", f"installed outside {mgr}"
|
|
277
|
+
if note.state == "can-manage":
|
|
278
|
+
return f" (via {mgr})", None
|
|
279
|
+
if note.state == "system-copy":
|
|
280
|
+
return f" ({note.executable} found outside {mgr})", None
|
|
281
|
+
return "", None
|
dev_setup/tools.yaml
CHANGED
|
@@ -802,6 +802,11 @@ tools:
|
|
|
802
802
|
docs_url: https://docs.astral.sh/uv/guides/install-python/
|
|
803
803
|
requires:
|
|
804
804
|
- uv
|
|
805
|
+
managed_by: uv
|
|
806
|
+
# The check is a shell expression and the managed executable is python3, not
|
|
807
|
+
# the key — version_cmd gives get_version (and managers' path signal) a real
|
|
808
|
+
# binary to resolve.
|
|
809
|
+
version_cmd: python3
|
|
805
810
|
install_script: |
|
|
806
811
|
set -euo pipefail
|
|
807
812
|
uv python install --default
|
|
@@ -858,6 +863,8 @@ tools:
|
|
|
858
863
|
npm uninstall -g @earendil-works/pi-coding-agent
|
|
859
864
|
requires:
|
|
860
865
|
- nvm
|
|
866
|
+
managed_by: nvm
|
|
867
|
+
version_cmd: pi
|
|
861
868
|
|
|
862
869
|
ripgrep:
|
|
863
870
|
name: ripgrep
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: devstuff
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.25.0
|
|
4
4
|
Summary: Development environment setup CLI for Linux
|
|
5
5
|
Project-URL: Repository, https://github.com/thesawdawg/dev-setup-py
|
|
6
6
|
Author-email: Sawyer <sawyerksu@gmail.com>
|
|
@@ -238,6 +238,7 @@ devstuff list --available # only packages not yet installed
|
|
|
238
238
|
```
|
|
239
239
|
|
|
240
240
|
Output columns: status (✔/✘), package key, description, install type, version (if installed), help command.
|
|
241
|
+
Tools another catalog tool manages or could manage get a second line — `✓ managed by uv`, `installed outside nvm`, `uv can manage this`, or a warning that a system copy (e.g. `/usr/bin/python3`) exists outside the manager — probed against the machine, not inferred from the catalog.
|
|
241
242
|
|
|
242
243
|
---
|
|
243
244
|
|
|
@@ -1729,6 +1730,7 @@ tools:
|
|
|
1729
1730
|
| `help_cmd` | no | Command shown in `list` under the package entry |
|
|
1730
1731
|
| `docs_url` | no | URL opened by `devstuff docs <key>` |
|
|
1731
1732
|
| `requires` | no | List of package keys that must already be installed |
|
|
1733
|
+
| `managed_by` | no | Catalog key of the tool that manages this one's installs (e.g. `uv`, `nvm`). Implied for `npm` → `nvm` and `pip`/`uvx` → `uv`; set it only when the type doesn't imply one |
|
|
1732
1734
|
| `npm_name` | npm | npm package name |
|
|
1733
1735
|
| `pip_name` | pip | PyPI package name. Extras work as-is: `pip_name: "ansible-lint[lock]"` |
|
|
1734
1736
|
| `uv_with` | no (pip/uvx) | Extra packages installed into the tool's environment (`uv tool install --with`) |
|
|
@@ -6,7 +6,7 @@ dev_setup/apply_exec.py,sha256=czzQxxYHWCAmAsgd9BvMPYlG2b63g0b3RHbbO5UyPRA,6364
|
|
|
6
6
|
dev_setup/apply_plan.py,sha256=L_ZmSGnjM7T1hKT7RLXSvCZgjbRpX_AaTKg5N9fp1zs,8474
|
|
7
7
|
dev_setup/base.py,sha256=j2EQ5gzeGgtveWQN_BgbLcZianMENJ7PQy8EQ9J9MPE,1946
|
|
8
8
|
dev_setup/bundles.py,sha256=h-WdjwNI82SQCgXiJ-EoiwuI81umb09Q0NNUYyzH1FI,2285
|
|
9
|
-
dev_setup/catalog.py,sha256=
|
|
9
|
+
dev_setup/catalog.py,sha256=FzSPmKbqJlYarg3KGH5FNOc6mOW-6ADl9Ydg2kmedmQ,6927
|
|
10
10
|
dev_setup/cli.py,sha256=KHdraEvcUf1IqSLkGjXyChSccBduPPvxvNefWfL4qzg,3407
|
|
11
11
|
dev_setup/doctor.py,sha256=1shwNLT5wFxiGT5oBVqbF478B7lcHVwT_e50aFb2I20,16962
|
|
12
12
|
dev_setup/function_runner.py,sha256=08F6jvB9-oOyE5ivYtRjnL16JTGsfRnkpvkjSVrJhsM,6957
|
|
@@ -14,15 +14,16 @@ dev_setup/functions.schema.json,sha256=VVdpH3xWsdbtqw47S1QqpBcs4O9wd3XZ_s0Q3sGwv
|
|
|
14
14
|
dev_setup/functions.yaml,sha256=n3yn8N9FN9TzMRMMgYREmDACUAsO1XmGDuNB-aOVl8U,13477
|
|
15
15
|
dev_setup/functions_catalog.py,sha256=YgR2hY9HM1iol1AZcF-_j02EXCP9U4P3e_5eWes9KH0,7116
|
|
16
16
|
dev_setup/functions_registry.py,sha256=YSl-VgNXPf0hj4WgReg-pZUj4fAjFlwvC165dgon_BE,3682
|
|
17
|
-
dev_setup/generic.py,sha256=
|
|
17
|
+
dev_setup/generic.py,sha256=AUGc3FzFFI3d4A_8Hg1nd9r5Q7wnFolSWqjr9i4T2zA,44110
|
|
18
18
|
dev_setup/links.schema.json,sha256=V9_1UA8Ejfu0j6-VczH0blW1mlGupXx56NhApLtHHKc,1938
|
|
19
19
|
dev_setup/links.yaml,sha256=nBwgCDljLbqY75ebQ9JuZao0-zJEwtJO6GNRV_eG7IM,7896
|
|
20
20
|
dev_setup/links_catalog.py,sha256=Xe7s9oqiCrfQPUwE-X9o6p5VkU7mH9PjY9NMyn6VbHg,4610
|
|
21
21
|
dev_setup/links_registry.py,sha256=xyq49oH1u_CX85UcizKSuxuy_pzurNoDwSRg3YftUMY,2439
|
|
22
|
+
dev_setup/managers.py,sha256=mW_MI9OfZsuxy8--PCHom-_CG3sFb9nPqJ26wQQVAIc,10665
|
|
22
23
|
dev_setup/profile.py,sha256=NiSOXXwEPX6IIT8FagnAC-tcg49HWijFDSm2jn3hjts,13632
|
|
23
24
|
dev_setup/registry.py,sha256=eHEuo4p0O0CHDWatFuOlSFiSAz5L6YFYmv9tAGHYMt4,2510
|
|
24
25
|
dev_setup/snapshot.py,sha256=A2G_6pHSaGhDT1PJAZ6eW83GdSdCGs2r79yH8FCa0Qs,5330
|
|
25
|
-
dev_setup/tools.yaml,sha256=
|
|
26
|
+
dev_setup/tools.yaml,sha256=jWW5JC_xkyQtVyA79d9FJdjC5F_-_6rYKTKv0C-1Fu0,43210
|
|
26
27
|
dev_setup/ui.py,sha256=B0t4hYlZ7jIMIdldMCImLNBJT1NQgZ4ff8ItjfHRNl0,23879
|
|
27
28
|
dev_setup/updates.py,sha256=p9_nbfaX_73hE71kr5ZDZA5o85T9XTR0mjbo15f950I,6046
|
|
28
29
|
dev_setup/verbose.py,sha256=N3U9JAYOvFwdd8DT6W7Pqq6RCIUfbcQnPsm0O1TnvQY,5003
|
|
@@ -58,9 +59,9 @@ dev_setup/commands/docs_cmd.py,sha256=JXhusKUl4dD-U5jG-PLTon_2NCpAWWnaBqsmlFk7vL
|
|
|
58
59
|
dev_setup/commands/doctor_cmd.py,sha256=sPhxLMVxy1JOxdFklRQHIwCoJeB-nmGWzVs5yeza9a8,3568
|
|
59
60
|
dev_setup/commands/functions_cmd.py,sha256=4HvdLXle9JGk70A1EDVZrlgTo-N-FyAO7ApaL8mcJYI,3023
|
|
60
61
|
dev_setup/commands/help_cmd.py,sha256=O2dnhqsMZx5tVHdJVixixCJwc9TYlKdlZ2vYYPApl0o,4566
|
|
61
|
-
dev_setup/commands/install_cmd.py,sha256=
|
|
62
|
+
dev_setup/commands/install_cmd.py,sha256=6h5KY2uReJt9nIlbrgOysmeIYgG7X767bPnUleGuHu8,9077
|
|
62
63
|
dev_setup/commands/links_cmd.py,sha256=kvnoBXdM9QWRZRIwWgnmWqVkOYE7AZxywFTQD5_Uwv4,4924
|
|
63
|
-
dev_setup/commands/list_cmd.py,sha256=
|
|
64
|
+
dev_setup/commands/list_cmd.py,sha256=Koi46SqFBnC-w2HypIaXI7E5eCtYg5q9fod5_rQ3k1o,3159
|
|
64
65
|
dev_setup/commands/mcp_cmd.py,sha256=UkScDupval0pHZhV1Mex6I8s9pnE7OS2Qf6zQhcQaxM,10261
|
|
65
66
|
dev_setup/commands/outdated_cmd.py,sha256=afwYyq0M-tWVOk2qyXQqsdWSTK6yuFbVpbrOmMPKS_w,4757
|
|
66
67
|
dev_setup/commands/profile_cmd.py,sha256=jo7al_nBwuWtzOLYKjcqEGmHp4eQrzM5s7ahv6iiGaw,18299
|
|
@@ -127,7 +128,7 @@ dev_setup/mcp/printconfig.py,sha256=3u_b4UpDwJ95u0_AfZuZuch1_-bOojdAg-08c5l6g28,
|
|
|
127
128
|
dev_setup/mcp/process.py,sha256=IV203HLaCelWb89IhV73_8NWNAGglXRtXpwpHk39dD4,4752
|
|
128
129
|
dev_setup/mcp/stdio.py,sha256=k-s2722_N2j92umkKo_Bq6KijfQGKFRudYVsh2H4xAk,6121
|
|
129
130
|
dev_setup/mcp/token.py,sha256=Pr7MCY6FtY8g2oQWB291mMooiZY0eu659Qk3mh9auWE,3397
|
|
130
|
-
devstuff-2.
|
|
131
|
-
devstuff-2.
|
|
132
|
-
devstuff-2.
|
|
133
|
-
devstuff-2.
|
|
131
|
+
devstuff-2.25.0.dist-info/METADATA,sha256=SyxiXelUGdD8e9aRRki8P-idNFfFI__aEY5A_2c2LiU,100610
|
|
132
|
+
devstuff-2.25.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
133
|
+
devstuff-2.25.0.dist-info/entry_points.txt,sha256=48ITy9ENdXDFrTHwAyVPUpq1MDmgFqcOisOo5mAR6OQ,53
|
|
134
|
+
devstuff-2.25.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|