vuer-cli 0.0.3__py3-none-any.whl → 0.0.5__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.
- vuer_cli/add.py +69 -84
- vuer_cli/envs_publish.py +335 -309
- vuer_cli/envs_pull.py +177 -170
- vuer_cli/login.py +459 -0
- vuer_cli/main.py +52 -88
- vuer_cli/mcap_extractor.py +866 -0
- vuer_cli/remove.py +87 -95
- vuer_cli/scripts/demcap.py +171 -0
- vuer_cli/scripts/mcap_playback.py +661 -0
- vuer_cli/scripts/minimap.py +365 -0
- vuer_cli/scripts/ptc_utils.py +434 -0
- vuer_cli/scripts/viz_ptc_cams.py +613 -0
- vuer_cli/scripts/viz_ptc_proxie.py +483 -0
- vuer_cli/sync.py +314 -308
- vuer_cli/upgrade.py +121 -136
- vuer_cli/utils.py +11 -38
- {vuer_cli-0.0.3.dist-info → vuer_cli-0.0.5.dist-info}/METADATA +59 -6
- vuer_cli-0.0.5.dist-info/RECORD +22 -0
- vuer_cli-0.0.3.dist-info/RECORD +0 -14
- {vuer_cli-0.0.3.dist-info → vuer_cli-0.0.5.dist-info}/WHEEL +0 -0
- {vuer_cli-0.0.3.dist-info → vuer_cli-0.0.5.dist-info}/entry_points.txt +0 -0
- {vuer_cli-0.0.3.dist-info → vuer_cli-0.0.5.dist-info}/licenses/LICENSE +0 -0
vuer_cli/add.py
CHANGED
|
@@ -1,93 +1,78 @@
|
|
|
1
1
|
"""Add command - add an environment spec to environment.json then sync."""
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import json
|
|
4
4
|
from pathlib import Path
|
|
5
|
-
from typing import Optional
|
|
6
5
|
|
|
7
|
-
import
|
|
6
|
+
from params_proto import proto
|
|
8
7
|
|
|
9
8
|
from .sync import Sync, read_environments_lock
|
|
10
|
-
from .utils import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# Use shared parser from utils; legacy '@' syntax is not supported anymore.
|
|
9
|
+
from .utils import normalize_env_spec, parse_env_spec, print_error
|
|
14
10
|
|
|
15
11
|
|
|
16
|
-
@
|
|
12
|
+
@proto
|
|
17
13
|
class Add:
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
print(
|
|
84
|
-
f"[INFO] Added {env_spec_normalized} to environment.json dependencies. Running sync..."
|
|
85
|
-
)
|
|
86
|
-
return Sync()()
|
|
87
|
-
|
|
88
|
-
except (FileNotFoundError, ValueError, RuntimeError) as e:
|
|
89
|
-
print_error(str(e))
|
|
90
|
-
return 1
|
|
91
|
-
except Exception as e:
|
|
92
|
-
print_error(f"Unexpected error: {e}")
|
|
93
|
-
return 1
|
|
14
|
+
"""Add an environment to environment.json and run `vuer sync`.
|
|
15
|
+
|
|
16
|
+
Example:
|
|
17
|
+
vuer add some-environment/v1.2.3
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
# Required positional arg: environment spec, e.g. "some-environment/v1.2.3"
|
|
21
|
+
env: str
|
|
22
|
+
|
|
23
|
+
def __call__(self) -> int:
|
|
24
|
+
"""Execute add command."""
|
|
25
|
+
try:
|
|
26
|
+
env_spec = self.env
|
|
27
|
+
|
|
28
|
+
name, version = parse_env_spec(env_spec)
|
|
29
|
+
env_spec_normalized = normalize_env_spec(f"{name}/{version}")
|
|
30
|
+
|
|
31
|
+
cwd = Path.cwd()
|
|
32
|
+
lock_path = cwd / "environments-lock.yaml"
|
|
33
|
+
|
|
34
|
+
# Step 2: Check if already present in environments-lock.yaml
|
|
35
|
+
if lock_path.exists():
|
|
36
|
+
existing_deps = read_environments_lock(lock_path)
|
|
37
|
+
if env_spec_normalized in existing_deps:
|
|
38
|
+
print(
|
|
39
|
+
f"[INFO] Environment {env_spec_normalized} already present in {lock_path}"
|
|
40
|
+
)
|
|
41
|
+
return 0
|
|
42
|
+
|
|
43
|
+
# Step 3: Ensure environment.json has this dependency, then run sync
|
|
44
|
+
env_json_path = cwd / "environment.json"
|
|
45
|
+
if env_json_path.exists():
|
|
46
|
+
with env_json_path.open("r", encoding="utf-8") as f:
|
|
47
|
+
try:
|
|
48
|
+
data = json.load(f)
|
|
49
|
+
except json.JSONDecodeError as e:
|
|
50
|
+
raise ValueError(f"Invalid environment.json: {e}") from e
|
|
51
|
+
else:
|
|
52
|
+
data = {}
|
|
53
|
+
|
|
54
|
+
deps = data.get("dependencies")
|
|
55
|
+
if deps is None:
|
|
56
|
+
deps = {}
|
|
57
|
+
if not isinstance(deps, dict):
|
|
58
|
+
raise ValueError("environment.json 'dependencies' field must be an object")
|
|
59
|
+
|
|
60
|
+
# Add or update the dependency
|
|
61
|
+
deps[name] = version
|
|
62
|
+
data["dependencies"] = deps
|
|
63
|
+
|
|
64
|
+
with env_json_path.open("w", encoding="utf-8") as f:
|
|
65
|
+
json.dump(data, f, indent=2, ensure_ascii=False)
|
|
66
|
+
f.write("\n")
|
|
67
|
+
|
|
68
|
+
print(
|
|
69
|
+
f"[INFO] Added {env_spec_normalized} to environment.json dependencies. Running sync..."
|
|
70
|
+
)
|
|
71
|
+
return Sync().run()
|
|
72
|
+
|
|
73
|
+
except (FileNotFoundError, ValueError, RuntimeError) as e:
|
|
74
|
+
print_error(str(e))
|
|
75
|
+
return 1
|
|
76
|
+
except Exception as e:
|
|
77
|
+
print_error(f"Unexpected error: {e}")
|
|
78
|
+
return 1
|