vuer-cli 0.0.1__tar.gz → 0.0.2__tar.gz

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.
@@ -0,0 +1,183 @@
1
+ Metadata-Version: 2.4
2
+ Name: vuer-cli
3
+ Version: 0.0.2
4
+ Summary: A Python CLI for Vuer, a real-time 3D visualization library
5
+ Project-URL: Homepage, https://github.com/vuer-ai/vuer-cli
6
+ Project-URL: Repository, https://github.com/vuer-ai/vuer-cli
7
+ Project-URL: Issues, https://github.com/vuer-ai/vuer-cli/issues
8
+ Author-email: Ge Yang <ge.ike.yang@gmail.com>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.8
21
+ Requires-Dist: params-proto>=3.0.0rc9
22
+ Requires-Dist: requests>=2.31.0
23
+ Requires-Dist: tqdm>=4.66.0
24
+ Provides-Extra: all
25
+ Provides-Extra: docs
26
+ Requires-Dist: furo; extra == 'docs'
27
+ Requires-Dist: myst-parser; extra == 'docs'
28
+ Requires-Dist: sphinx-autobuild; extra == 'docs'
29
+ Requires-Dist: sphinx-copybutton; extra == 'docs'
30
+ Requires-Dist: sphinx>=4.0; extra == 'docs'
31
+ Requires-Dist: tomli>=1.1.0; (python_version < '3.11') and extra == 'docs'
32
+ Provides-Extra: example
33
+ Description-Content-Type: text/markdown
34
+
35
+ # Vuer Hub Environment Manager
36
+
37
+ Vuer HUB and the vuer command line tool enable you to manage, version-control,
38
+ and distribute physical simulation environments the same way you manage
39
+ software packages.
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install vuer-cli
45
+ ```
46
+
47
+ ## Environment Variables
48
+
49
+ | Variable | Required | Description |
50
+ |-------------------|----------|--------------------------------------------------------------------------|
51
+ | `VUER_AUTH_TOKEN` | ✅ | JWT token used for all authenticated requests |
52
+ | `VUER_HUB_URL` | ✅ | Base URL of the Vuer Hub API (required — no default; e.g. `https://hub.vuer.ai/api`) |
53
+
54
+ ## Commands
55
+
56
+ | Command | Description |
57
+ |----------------|-----------------------------------------------------------------------|
58
+ | `vuer` | Show top-level help and list available commands |
59
+ | `vuer --help` | Show detailed CLI help |
60
+ | `sync` | Sync all environments from environment.json dependencies (like npm install) |
61
+ | `add` | Add an environment dependency to environment.json |
62
+ | `remove` | Remove an environment dependency from environment.json |
63
+ | `upgrade` | Upgrade an environment dependency in environment.json to latest |
64
+ | `envs-publish` | Publish an environment version |
65
+ | `envs-pull` | Download an environment by ID or `name/version` |
66
+
67
+ ## Usage
68
+
69
+ Quick start — configure environment variables
70
+
71
+ `VUER_HUB_URL` is required and has no default. Set it to the base URL of your Vuer Hub API.
72
+
73
+ ```bash
74
+ export VUER_HUB_URL="https://hub.vuer.ai/api"
75
+ # Optional: token for private hubs or authenticated operations
76
+ export VUER_AUTH_TOKEN="eyJhbGci..."
77
+ # Optional: enable dry-run mode to simulate operations (no network changes)
78
+ export VUER_CLI_DRY_RUN="1"
79
+ ```
80
+
81
+ ```bash
82
+ # Sync all environments from environment.json dependencies
83
+ # Reads environment.json in current directory, validates dependencies,
84
+ # and downloads all environments (including transitive deps) to vuer_environments/
85
+ vuer sync
86
+ vuer sync --output ./my-envs
87
+
88
+ # Publish an environment (requires environment.json in the directory)
89
+ vuer envs-publish --directory ./my-environment
90
+
91
+ # Pull an environment (download and unpack into a directory)
92
+ vuer envs-pull <environmentId>
93
+ vuer envs-pull my-environment/1.0.0
94
+
95
+ # Add an environment
96
+ vuer add --env <environmentId>
97
+ ```
98
+
99
+ ### Sync Command Details
100
+
101
+ The `sync` command works like `npm install`:
102
+
103
+ 1. Reads `environment.json` from the current directory
104
+ 2. Parses the `dependencies` field (e.g., `{"some-dependency": "1.2.3"}`)
105
+ 3. Validates all dependencies exist in the backend
106
+ 4. Fetches transitive dependencies for each environment
107
+ 5. Downloads all environments (direct + transitive) to `vuer_environments/` directory
108
+ 6. Preserves `environment.json` inside downloaded environment directories
109
+
110
+ Publishing metadata (used by `envs-publish`)
111
+
112
+ ```json
113
+ {
114
+ "name": "my-environment",
115
+ "version": "v1.0.0",
116
+ "description": "Demo robotic arm env",
117
+ "visibility": "PUBLIC",
118
+ "env-type": "isaac",
119
+ "dependencies": {
120
+ "my-environment-1": "v4.0.0"
121
+ }
122
+ }
123
+ ```
124
+
125
+ Fields and recommendations for publishing metadata
126
+ - **name** (string, required): logical name of the environment (no slashes). This becomes the directory name under `vuer_environments/<name>/<version>/` when downloaded.
127
+ - **version** (string, required): environment version string. Use a stable, reproducible format (we recommend semantic style like `v1.0.0`).
128
+ - **description** (string, optional): short human-readable description of the environment.
129
+ - **visibility** (string, optional): publishing visibility, commonly `PUBLIC` or `PRIVATE`.
130
+ - **env-type** (string, optional): environment runtime/type identifier (for example `isaac`, `gazebo`, etc.).
131
+ - **dependencies** (object, optional): mapping of dependency-name → version (e.g. `"some-dependency": "v1.2.3"`). These declare upstream environment dependencies and are validated during publish.
132
+
133
+ Publishing notes
134
+ - `envs-publish` expects the target directory to contain a valid `environment.json`. At minimum `name` and `version` must be present; `envs-publish` will validate metadata before uploading to `VUER_HUB_URL`.
135
+ - The `environment.json` baked into an environment package is preserved when that package is later downloaded to `vuer_environments/<name>/<version>/`.
136
+ - Keep the publishing `environment.json` authoritative: use `dependencies` to declare exact `name → version` mappings for transitive resolution.
137
+
138
+ Project-level `environment.json` used by `vuer sync`
139
+
140
+ For projects that consume environments (i.e., run `vuer sync`), you usually keep a simple `environment.json` at the project root that focuses on the `dependencies` map:
141
+
142
+ ```json
143
+ {
144
+ "dependencies": {
145
+ "some-dependency": "v1.2.3",
146
+ "another-dependency": "v4.5.6"
147
+ }
148
+ }
149
+ ```
150
+
151
+ Note: The project-level `environment.json` used by `vuer sync` typically only needs a `dependencies` mapping. The publishing `environment.json` (shown above) must include `name` and `version`.
152
+
153
+ Use `vuer <command> --help` for full options.
154
+
155
+ ### Add Command Details
156
+
157
+ - Purpose: add an environment dependency to the current directory's `environment.json`.
158
+ - Input: an environment identifier in canonical `name/version` form or a hub-specific environment ID (example: `my-environment/1.0.0`).
159
+ - Behavior: validates the environment exists on the configured `VUER_HUB_URL` and updates the `dependencies` section of `environment.json`. Run `vuer sync` afterwards to download the environment and its transitive dependencies into `vuer_environments/`.
160
+
161
+ ### Remove Command Details
162
+
163
+ - Purpose: remove a specific environment dependency from the current directory's `environment.json`.
164
+ - Input: a canonical `name/version` spec (exact match required).
165
+ - Behavior: removes only the exact `name/version` entry from `environment.json`. If the corresponding version directory exists under `vuer_environments/<name>/<version>/`, the local copy will be removed; empty parent directories are cleaned up automatically.
166
+
167
+ ### Upgrade Command Details
168
+
169
+ - Purpose: update an existing dependency in `environment.json` to a newer version.
170
+ - Input: a dependency name (to upgrade to the latest available) or an explicit `name/version` to target.
171
+ - Behavior: queries the configured hub for available versions, updates `environment.json` with the selected version, and leaves installation to `vuer sync`.
172
+
173
+ ### envs-publish Command Details
174
+
175
+ - Purpose: publish a prepared environment directory to the configured hub.
176
+ - Input: a local directory containing an `environment.json` and environment content.
177
+ - Behavior: validates the local environment metadata, then uploads the environment as a new version to `VUER_HUB_URL`. Authenticated operations require `VUER_AUTH_TOKEN`.
178
+
179
+ ### envs-pull Command Details
180
+
181
+ - Purpose: download an environment from the hub and place it into a local directory.
182
+ - Input: a hub environment ID or canonical `name/version` (e.g., `my-environment/1.0.0`).
183
+ - Behavior: downloads the environment and creates the nested path `vuer_environments/<name>/<version>/` (or an alternate `--output` path), preserving the bundled `environment.json` metadata.
@@ -0,0 +1,149 @@
1
+ # Vuer Hub Environment Manager
2
+
3
+ Vuer HUB and the vuer command line tool enable you to manage, version-control,
4
+ and distribute physical simulation environments the same way you manage
5
+ software packages.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install vuer-cli
11
+ ```
12
+
13
+ ## Environment Variables
14
+
15
+ | Variable | Required | Description |
16
+ |-------------------|----------|--------------------------------------------------------------------------|
17
+ | `VUER_AUTH_TOKEN` | ✅ | JWT token used for all authenticated requests |
18
+ | `VUER_HUB_URL` | ✅ | Base URL of the Vuer Hub API (required — no default; e.g. `https://hub.vuer.ai/api`) |
19
+
20
+ ## Commands
21
+
22
+ | Command | Description |
23
+ |----------------|-----------------------------------------------------------------------|
24
+ | `vuer` | Show top-level help and list available commands |
25
+ | `vuer --help` | Show detailed CLI help |
26
+ | `sync` | Sync all environments from environment.json dependencies (like npm install) |
27
+ | `add` | Add an environment dependency to environment.json |
28
+ | `remove` | Remove an environment dependency from environment.json |
29
+ | `upgrade` | Upgrade an environment dependency in environment.json to latest |
30
+ | `envs-publish` | Publish an environment version |
31
+ | `envs-pull` | Download an environment by ID or `name/version` |
32
+
33
+ ## Usage
34
+
35
+ Quick start — configure environment variables
36
+
37
+ `VUER_HUB_URL` is required and has no default. Set it to the base URL of your Vuer Hub API.
38
+
39
+ ```bash
40
+ export VUER_HUB_URL="https://hub.vuer.ai/api"
41
+ # Optional: token for private hubs or authenticated operations
42
+ export VUER_AUTH_TOKEN="eyJhbGci..."
43
+ # Optional: enable dry-run mode to simulate operations (no network changes)
44
+ export VUER_CLI_DRY_RUN="1"
45
+ ```
46
+
47
+ ```bash
48
+ # Sync all environments from environment.json dependencies
49
+ # Reads environment.json in current directory, validates dependencies,
50
+ # and downloads all environments (including transitive deps) to vuer_environments/
51
+ vuer sync
52
+ vuer sync --output ./my-envs
53
+
54
+ # Publish an environment (requires environment.json in the directory)
55
+ vuer envs-publish --directory ./my-environment
56
+
57
+ # Pull an environment (download and unpack into a directory)
58
+ vuer envs-pull <environmentId>
59
+ vuer envs-pull my-environment/1.0.0
60
+
61
+ # Add an environment
62
+ vuer add --env <environmentId>
63
+ ```
64
+
65
+ ### Sync Command Details
66
+
67
+ The `sync` command works like `npm install`:
68
+
69
+ 1. Reads `environment.json` from the current directory
70
+ 2. Parses the `dependencies` field (e.g., `{"some-dependency": "1.2.3"}`)
71
+ 3. Validates all dependencies exist in the backend
72
+ 4. Fetches transitive dependencies for each environment
73
+ 5. Downloads all environments (direct + transitive) to `vuer_environments/` directory
74
+ 6. Preserves `environment.json` inside downloaded environment directories
75
+
76
+ Publishing metadata (used by `envs-publish`)
77
+
78
+ ```json
79
+ {
80
+ "name": "my-environment",
81
+ "version": "v1.0.0",
82
+ "description": "Demo robotic arm env",
83
+ "visibility": "PUBLIC",
84
+ "env-type": "isaac",
85
+ "dependencies": {
86
+ "my-environment-1": "v4.0.0"
87
+ }
88
+ }
89
+ ```
90
+
91
+ Fields and recommendations for publishing metadata
92
+ - **name** (string, required): logical name of the environment (no slashes). This becomes the directory name under `vuer_environments/<name>/<version>/` when downloaded.
93
+ - **version** (string, required): environment version string. Use a stable, reproducible format (we recommend semantic style like `v1.0.0`).
94
+ - **description** (string, optional): short human-readable description of the environment.
95
+ - **visibility** (string, optional): publishing visibility, commonly `PUBLIC` or `PRIVATE`.
96
+ - **env-type** (string, optional): environment runtime/type identifier (for example `isaac`, `gazebo`, etc.).
97
+ - **dependencies** (object, optional): mapping of dependency-name → version (e.g. `"some-dependency": "v1.2.3"`). These declare upstream environment dependencies and are validated during publish.
98
+
99
+ Publishing notes
100
+ - `envs-publish` expects the target directory to contain a valid `environment.json`. At minimum `name` and `version` must be present; `envs-publish` will validate metadata before uploading to `VUER_HUB_URL`.
101
+ - The `environment.json` baked into an environment package is preserved when that package is later downloaded to `vuer_environments/<name>/<version>/`.
102
+ - Keep the publishing `environment.json` authoritative: use `dependencies` to declare exact `name → version` mappings for transitive resolution.
103
+
104
+ Project-level `environment.json` used by `vuer sync`
105
+
106
+ For projects that consume environments (i.e., run `vuer sync`), you usually keep a simple `environment.json` at the project root that focuses on the `dependencies` map:
107
+
108
+ ```json
109
+ {
110
+ "dependencies": {
111
+ "some-dependency": "v1.2.3",
112
+ "another-dependency": "v4.5.6"
113
+ }
114
+ }
115
+ ```
116
+
117
+ Note: The project-level `environment.json` used by `vuer sync` typically only needs a `dependencies` mapping. The publishing `environment.json` (shown above) must include `name` and `version`.
118
+
119
+ Use `vuer <command> --help` for full options.
120
+
121
+ ### Add Command Details
122
+
123
+ - Purpose: add an environment dependency to the current directory's `environment.json`.
124
+ - Input: an environment identifier in canonical `name/version` form or a hub-specific environment ID (example: `my-environment/1.0.0`).
125
+ - Behavior: validates the environment exists on the configured `VUER_HUB_URL` and updates the `dependencies` section of `environment.json`. Run `vuer sync` afterwards to download the environment and its transitive dependencies into `vuer_environments/`.
126
+
127
+ ### Remove Command Details
128
+
129
+ - Purpose: remove a specific environment dependency from the current directory's `environment.json`.
130
+ - Input: a canonical `name/version` spec (exact match required).
131
+ - Behavior: removes only the exact `name/version` entry from `environment.json`. If the corresponding version directory exists under `vuer_environments/<name>/<version>/`, the local copy will be removed; empty parent directories are cleaned up automatically.
132
+
133
+ ### Upgrade Command Details
134
+
135
+ - Purpose: update an existing dependency in `environment.json` to a newer version.
136
+ - Input: a dependency name (to upgrade to the latest available) or an explicit `name/version` to target.
137
+ - Behavior: queries the configured hub for available versions, updates `environment.json` with the selected version, and leaves installation to `vuer sync`.
138
+
139
+ ### envs-publish Command Details
140
+
141
+ - Purpose: publish a prepared environment directory to the configured hub.
142
+ - Input: a local directory containing an `environment.json` and environment content.
143
+ - Behavior: validates the local environment metadata, then uploads the environment as a new version to `VUER_HUB_URL`. Authenticated operations require `VUER_AUTH_TOKEN`.
144
+
145
+ ### envs-pull Command Details
146
+
147
+ - Purpose: download an environment from the hub and place it into a local directory.
148
+ - Input: a hub environment ID or canonical `name/version` (e.g., `my-environment/1.0.0`).
149
+ - Behavior: downloads the environment and creates the nested path `vuer_environments/<name>/<version>/` (or an alternate `--output` path), preserving the bundled `environment.json` metadata.
@@ -4,11 +4,14 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "vuer-cli"
7
- version = "0.0.1"
7
+ version = "0.0.2"
8
8
  description = "A Python CLI for Vuer, a real-time 3D visualization library"
9
- readme = "README.md"
9
+ readme = { file = "README.md", "content-type" = "text/markdown" }
10
10
  license = { text = "MIT" }
11
11
  requires-python = ">=3.8"
12
+ authors = [
13
+ { name = "Ge Yang", email = "ge.ike.yang@gmail.com" }
14
+ ]
12
15
  classifiers = [
13
16
  "Development Status :: 3 - Alpha",
14
17
  "Programming Language :: Python",
@@ -21,14 +24,29 @@ classifiers = [
21
24
  "Operating System :: OS Independent",
22
25
  ]
23
26
  dependencies = [
24
- "params-proto>=3.0.0rc3",
27
+ "params-proto>=3.0.0rc9",
28
+ "requests>=2.31.0",
29
+ "tqdm>=4.66.0",
25
30
  ]
26
31
 
32
+ [project.urls]
33
+ Homepage = "https://github.com/vuer-ai/vuer-cli"
34
+ Repository = "https://github.com/vuer-ai/vuer-cli"
35
+ Issues = "https://github.com/vuer-ai/vuer-cli/issues"
36
+
27
37
  [project.optional-dependencies]
28
38
  all = [
29
39
  ]
30
40
  example = [
31
41
  ]
42
+ docs = [
43
+ "sphinx>=4.0",
44
+ "furo",
45
+ "myst-parser",
46
+ "sphinx-copybutton",
47
+ "sphinx-autobuild",
48
+ "tomli>=1.1.0; python_version < '3.11'",
49
+ ]
32
50
 
33
51
  [project.scripts]
34
52
  vuer = "vuer_cli:entrypoint"
@@ -0,0 +1,20 @@
1
+ """Vuer CLI - Environment Manager for Vuer Hub."""
2
+
3
+ from .add import Add
4
+ from .envs_publish import EnvsPublish, Hub
5
+ from .envs_pull import EnvsPull
6
+ from .main import entrypoint
7
+ from .remove import Remove
8
+ from .sync import Sync
9
+ from .upgrade import Upgrade
10
+
11
+ __all__ = [
12
+ "entrypoint",
13
+ "Hub",
14
+ "Sync",
15
+ "Add",
16
+ "Remove",
17
+ "Upgrade",
18
+ "EnvsPublish",
19
+ "EnvsPull",
20
+ ]
@@ -0,0 +1,93 @@
1
+ """Add command - add an environment spec to environment.json then sync."""
2
+
3
+ from dataclasses import dataclass
4
+ from pathlib import Path
5
+ from typing import Optional
6
+
7
+ import json
8
+
9
+ from .sync import Sync, read_environments_lock
10
+ from .utils import print_error, parse_env_spec, normalize_env_spec
11
+
12
+
13
+ # Use shared parser from utils; legacy '@' syntax is not supported anymore.
14
+
15
+
16
+ @dataclass
17
+ class Add:
18
+ """Add an environment to environment.json and run `vuer sync`.
19
+
20
+ Example:
21
+ vuer add some-environment/v1.2.3
22
+ """
23
+
24
+ # NOTE: We keep these fields for params-proto compatibility, but the primary
25
+ # way to call this command is positional: `vuer add name@version`.
26
+ env: str = "" # Environment spec to add, e.g. "some-environment/v1.2.3"
27
+ name: Optional[str] = None # Unused in current workflow
28
+ version: str = "latest" # Unused in current workflow
29
+
30
+ def __call__(self) -> int:
31
+ """Execute add command."""
32
+ try:
33
+ env_spec = self.env
34
+ if not env_spec:
35
+ # If env is empty, params-proto likely didn't map the positional arg;
36
+ # treat this as a usage error.
37
+ raise ValueError(
38
+ "Missing environment spec. Usage: vuer add some-environment/v1.2.3"
39
+ )
40
+
41
+ name, version = parse_env_spec(env_spec)
42
+ env_spec_normalized = normalize_env_spec(f"{name}/{version}")
43
+
44
+ cwd = Path.cwd()
45
+ lock_path = cwd / "environments-lock.yaml"
46
+
47
+ # Step 2: Check if already present in environments-lock.yaml
48
+ if lock_path.exists():
49
+ existing_deps = read_environments_lock(lock_path)
50
+ if env_spec_normalized in existing_deps:
51
+ print(f"[INFO] Environment {env_spec_normalized} already present in {lock_path}")
52
+ return 0
53
+
54
+ # Step 3: Ensure environment.json has this dependency, then run sync
55
+ env_json_path = cwd / "environment.json"
56
+ if env_json_path.exists():
57
+ with env_json_path.open("r", encoding="utf-8") as f:
58
+ try:
59
+ data = json.load(f)
60
+ except json.JSONDecodeError as e:
61
+ raise ValueError(
62
+ f"Invalid environment.json: {e}"
63
+ ) from e
64
+ else:
65
+ data = {}
66
+
67
+ deps = data.get("dependencies")
68
+ if deps is None:
69
+ deps = {}
70
+ if not isinstance(deps, dict):
71
+ raise ValueError(
72
+ "environment.json 'dependencies' field must be an object"
73
+ )
74
+
75
+ # Add or update the dependency
76
+ deps[name] = version
77
+ data["dependencies"] = deps
78
+
79
+ with env_json_path.open("w", encoding="utf-8") as f:
80
+ json.dump(data, f, indent=2, ensure_ascii=False)
81
+ f.write("\n")
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