unidroid-cli 0.3.0__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.
Files changed (40) hide show
  1. unidroid_cli-0.3.0/.gitignore +7 -0
  2. unidroid_cli-0.3.0/PKG-INFO +196 -0
  3. unidroid_cli-0.3.0/README.md +177 -0
  4. unidroid_cli-0.3.0/pyproject.toml +40 -0
  5. unidroid_cli-0.3.0/src/unidroid_cli/__init__.py +1 -0
  6. unidroid_cli-0.3.0/src/unidroid_cli/__main__.py +3 -0
  7. unidroid_cli-0.3.0/src/unidroid_cli/_common.py +74 -0
  8. unidroid_cli-0.3.0/src/unidroid_cli/agent.py +392 -0
  9. unidroid_cli-0.3.0/src/unidroid_cli/bench.py +143 -0
  10. unidroid_cli-0.3.0/src/unidroid_cli/checks.py +42 -0
  11. unidroid_cli-0.3.0/src/unidroid_cli/cli.py +105 -0
  12. unidroid_cli-0.3.0/src/unidroid_cli/commands/__init__.py +1 -0
  13. unidroid_cli-0.3.0/src/unidroid_cli/commands/account.py +118 -0
  14. unidroid_cli-0.3.0/src/unidroid_cli/commands/auth.py +155 -0
  15. unidroid_cli-0.3.0/src/unidroid_cli/commands/bench.py +132 -0
  16. unidroid_cli-0.3.0/src/unidroid_cli/commands/challenge.py +97 -0
  17. unidroid_cli-0.3.0/src/unidroid_cli/commands/dataset.py +546 -0
  18. unidroid_cli-0.3.0/src/unidroid_cli/commands/submission.py +478 -0
  19. unidroid_cli-0.3.0/src/unidroid_cli/commands/validator.py +124 -0
  20. unidroid_cli-0.3.0/src/unidroid_cli/compare.py +64 -0
  21. unidroid_cli-0.3.0/src/unidroid_cli/config.py +85 -0
  22. unidroid_cli-0.3.0/src/unidroid_cli/dataset.py +414 -0
  23. unidroid_cli-0.3.0/src/unidroid_cli/dataset_sample.py +594 -0
  24. unidroid_cli-0.3.0/src/unidroid_cli/hfrepo.py +202 -0
  25. unidroid_cli-0.3.0/src/unidroid_cli/http.py +66 -0
  26. unidroid_cli-0.3.0/src/unidroid_cli/protocol.py +80 -0
  27. unidroid_cli-0.3.0/src/unidroid_cli/safe_extract.py +58 -0
  28. unidroid_cli-0.3.0/src/unidroid_cli/uploads.py +76 -0
  29. unidroid_cli-0.3.0/src/unidroid_cli/wallet.py +62 -0
  30. unidroid_cli-0.3.0/tests/protocol_vectors.json +85 -0
  31. unidroid_cli-0.3.0/tests/test_agent.py +135 -0
  32. unidroid_cli-0.3.0/tests/test_backend_e2e.py +268 -0
  33. unidroid_cli-0.3.0/tests/test_bundle_e2e.py +116 -0
  34. unidroid_cli-0.3.0/tests/test_checks_bench.py +88 -0
  35. unidroid_cli-0.3.0/tests/test_cli_auth.py +88 -0
  36. unidroid_cli-0.3.0/tests/test_command_tree.py +61 -0
  37. unidroid_cli-0.3.0/tests/test_compare.py +29 -0
  38. unidroid_cli-0.3.0/tests/test_dataset_e2e.py +400 -0
  39. unidroid_cli-0.3.0/tests/test_hardening.py +253 -0
  40. unidroid_cli-0.3.0/tests/test_protocol.py +44 -0
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.egg-info/
3
+ .venv/
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ dist/
7
+ build/
@@ -0,0 +1,196 @@
1
+ Metadata-Version: 2.5
2
+ Name: unidroid-cli
3
+ Version: 0.3.0
4
+ Summary: udcli - the Unidroid command line: auth, account, challenge, submission, bench, dataset and validator
5
+ License: MIT
6
+ Requires-Python: >=3.10
7
+ Requires-Dist: httpx>=0.27
8
+ Requires-Dist: huggingface-hub>=0.25
9
+ Requires-Dist: pyyaml>=6
10
+ Requires-Dist: rich>=13
11
+ Requires-Dist: typer>=0.12
12
+ Provides-Extra: dev
13
+ Requires-Dist: py-sr25519-bindings>=0.2; extra == 'dev'
14
+ Requires-Dist: pytest>=8; extra == 'dev'
15
+ Requires-Dist: ruff>=0.4; extra == 'dev'
16
+ Provides-Extra: wallet
17
+ Requires-Dist: bittensor-wallet>=4.0; extra == 'wallet'
18
+ Description-Content-Type: text/markdown
19
+
20
+ # udcli - Unidroid CLI
21
+
22
+ Submit robotics models (VLAs, WAMs, world models) to [Unidroid](https://unidroid.ai) challenges,
23
+ manage your account, evaluate locally and use BenchHub.
24
+
25
+ ```bash
26
+ pip install unidroid-cli # core
27
+ pip install "unidroid-cli[wallet]" # needed for submission submit / account coldkey register
28
+ ```
29
+
30
+ Env: `UNIDROID_API_URL` (`https://api.unidroid.ai`), `UNIDROID_API_KEY`, `UNIDROID_HOME` (`~/.unidroid`),
31
+ `UNIDROID_CACHE_DIR` (`~/.unidroid/bench-cache`), `HF_TOKEN`. Without `UNIDROID_API_URL` or `--api-url`,
32
+ `udcli` talks to `https://api.unidroid.ai`. `~/.unidroid/credentials.json` is written atomically and limited to
33
+ your user.
34
+
35
+ Commands that cannot be undone (`account coldkey remove`, `auth keys delete`, `dataset discard`,
36
+ `dataset archive`) ask first; pass `--yes` / `-y` to skip the question in scripts.
37
+
38
+ ## Commands
39
+
40
+ Commands are grouped by what they act on, like the Hugging Face `hf` CLI. `udcli <group>` (or `-h` at any level)
41
+ lists what a group can do.
42
+
43
+ | Group | Commands | For |
44
+ | --- | --- | --- |
45
+ | `auth` | `login`, `logout`, `whoami`, `keys list\|create\|revoke\|delete`, `hf set\|status\|remove` | Who you are, API keys, the Hugging Face read token |
46
+ | `account` | `balance`, `ledger`, `claim`, `coldkey list\|register\|remove` | Platform balance, TAO deposits, coldkeys |
47
+ | `challenge` | `list`, `show`, `leaderboard` | Browsing challenges |
48
+ | `submission` | `hash`, `push`, `check`, `eval`, `submit`, `resume`, `list`, `show` | Your entries, from preparing to results |
49
+ | `bench` | `list`, `info`, `download`, `upload`, `link`, `status`, `cache list\|info\|clear` | BenchHub benchmarks |
50
+ | `dataset` | `list`, `info`, `mine`, `buy`, `download`, `upload`, `media`, `uploads`, `discard`, `set-price`, `edit`, `pending`, `approve`, `reject`, `archive`, `restore` | Datasets for sale |
51
+ | `validator` | `pending`, `fetch` | Validator accounts |
52
+
53
+ `--api-key` and `--api-url` work on every command, before or after the subcommand. They apply only to
54
+ that run, so you can use another account without `udcli auth login` and without replacing the saved key.
55
+ `UNIDROID_API_KEY` does the same when the flag is omitted. List commands accept `--json`.
56
+
57
+ ## Miner quick start
58
+
59
+ ```bash
60
+ udcli auth login # optional: save an API key from unidroid.ai/account/api-keys
61
+ udcli account balance --api-key unidroid_... # or pass the key on any command; overrides login
62
+ udcli auth hf set # read-only HF token for validators
63
+ udcli account coldkey register --wallet miner
64
+ udcli account coldkey remove <ss58> # or: --wallet miner
65
+ udcli account balance # shows the address to send TAO to
66
+ # After transferring TAO from that coldkey:
67
+ udcli account claim 9092713-0006 # extrinsic id from the block explorer
68
+
69
+ udcli challenge list
70
+ udcli challenge show pi05-libero-s1
71
+ udcli submission hash --path ./my-submission
72
+ udcli submission check --path ./my-submission --challenge pi05-libero-s1
73
+ udcli submission eval --challenge pi05-libero-s1 --hf-repo you/pi05-libero # docker + GPU, same sandbox as validators
74
+ udcli submission eval --challenge pi05-libero-s1 --model-dir ./model # a local model folder, mounted at /model
75
+ udcli submission submit --path ./my-submission --hf-repo you/pi05-libero --challenge pi05-libero-s1 \
76
+ --wallet miner --hotkey default
77
+ udcli submission list
78
+ udcli submission show 42 # each validator's status, score, error, success rate, episodes
79
+ udcli submission show 42 --compare udcli-eval-pi05-libero-s1-<ts>/out/results.json
80
+ udcli challenge leaderboard pi05-libero-s1
81
+ ```
82
+
83
+ `submission eval` runs the public eval config on the challenge's public benchmarks in the validator sandbox.
84
+ `submission show --compare` puts that local `results.json` next to what validators reported: the score, the
85
+ success rate and episode count, and whether your run used the same eval config (by sha256).
86
+
87
+ Every submission is a folder: `agent.yaml`, `brain/`, `train/`, optional `tests/` and `docs/`, and `weights/`.
88
+ Weights go to your own Hugging Face repo; the rest goes to Unidroid as one deterministic ZIP. `agent.yaml` lists
89
+ the sha256 of every file under `weights/`, and the hotkey signs those hashes with the ZIP's hash. Keep the pinned
90
+ commit available and unchanged until Review ends, or you're disqualified. Winners are copied to Unidroid's HF org
91
+ before payout; the published copy also holds the ZIP.
92
+
93
+ ```bash
94
+ udcli submission hash --path ./my-submission # (re)write the weights: block of agent.yaml
95
+ udcli submission hash --path ./my-submission --check # verify only
96
+ udcli submission check --path ./my-submission --challenge pi05-franka-s1
97
+ udcli submission push --path ./my-submission --hf-repo you/pi05-weights # optional: push weights/ on its own
98
+ udcli submission submit --path ./my-submission --hf-repo you/pi05-weights --challenge pi05-franka-s1 \
99
+ --wallet miner --hotkey default
100
+ udcli submission resume <upload-id> # finish an interrupted upload (24 hours)
101
+ ```
102
+
103
+ `submission submit` pushes `weights/` with your local Hugging Face login (`HF_TOKEN` or `hf auth login`;
104
+ it never leaves your machine), creating a private repo when missing and skipping the push when `main`
105
+ already holds the same files. It then pins the commit, compares it with `agent.yaml`, builds the ZIP and
106
+ uploads it. The publication terms and the fee are shown first: nothing is pushed to Hugging Face until you accept,
107
+ and any files on `main` that `agent.yaml` does not declare are listed before they are removed. Interrupted
108
+ uploads resume without re-sending finished parts. `--skip-upload --revision <sha>` uses weights you pushed
109
+ yourself (`--revision` is only valid with `--skip-upload`), `--write-hashes` rewrites stale
110
+ hashes without asking. Validators download with the read token saved by `udcli auth hf set`; it must belong
111
+ to the repo owner and must not be able to write. The fee is charged when the upload completes. `.DS_Store`,
112
+ `Thumbs.db`, swap and backup files, `.cache/`, `.git/` and `__pycache__/` are never hashed or uploaded; any
113
+ other dot file under `weights/` is refused.
114
+
115
+ ## Validators
116
+
117
+ ```bash
118
+ udcli validator pending [--challenge pi05-franka-s1]
119
+ udcli validator fetch 42 --out ./submission-42 # every hash checked against what the miner signed
120
+ ```
121
+
122
+ ## BenchHub
123
+
124
+ ```bash
125
+ udcli bench list [--category manipulation] [--visibility public]
126
+ udcli bench info libero-spatial
127
+ udcli bench download libero-spatial # sha256-verified, cached
128
+ udcli bench upload ./my-bench --visibility private [--thumbnail cover.png] # team role
129
+ udcli bench link franka-tabletop-v13 --visibility private # admin, Nepher EnvHub
130
+ udcli bench status
131
+ udcli bench cache list | info | clear [id]
132
+ ```
133
+
134
+ A benchmark is either uploaded to R2 or linked from the Nepher EnvHub. `bench link` is admin only: it takes an
135
+ EnvHub environment id, and the server reads that bundle's `manifest.yaml` as the BenchHub record. The bundle
136
+ stays on EnvHub and the server pins its current sha256. Downloads work the same for both: the API checks access
137
+ and returns a short-lived URL, and EnvHub bundles are streamed through the Unidroid API. You never need a Nepher
138
+ API key.
139
+
140
+ - **Public**: any logged-in user.
141
+ - **Private**: validators and the uploading team, only during the active window (UTC). Never miners.
142
+ - **Admins**: always.
143
+
144
+ A bundle needs `manifest.yaml` with `id`, `name`, `category`, `format`,
145
+ `description`. Optional: `robot` (for example `franka-panda`) and `robot_type` (any string, for example
146
+ `arm` or `humanoid`). Put any revision in the id. A benchmark id is immutable.
147
+
148
+ ## Datasets
149
+
150
+ Robot datasets for training VLA models. Anyone can browse; buying and downloading need `udcli auth login`.
151
+
152
+ ```bash
153
+ udcli dataset list [--search franka] [--free] [--sort popular]
154
+ udcli dataset info franka-pick-place-v1 # price, size, license, Hugging Face preview, what you may do
155
+ udcli dataset buy franka-pick-place-v1 # pays from your balance (see: udcli account balance)
156
+ udcli dataset download franka-pick-place-v1 [--out ./data] [--extract]
157
+ udcli dataset mine
158
+ ```
159
+
160
+ Downloads resume after an interruption and are checked against the published sha256. Archives are unpacked
161
+ safely: nothing leaves the target folder.
162
+
163
+ Admins upload and price datasets; a super admin approves an admin's upload (a super admin's own upload goes on
164
+ sale once verified):
165
+
166
+ ```bash
167
+ udcli dataset upload ./my-dataset --id franka-pick-place-v1 --license CC-BY-4.0 --price 25 \
168
+ --robot franka-panda --hf-repo unidroid/franka-pick-place-v1-sample --sample-episodes 3 \
169
+ --thumbnail ./cover.png --video ./preview.mp4
170
+ udcli dataset media franka-pick-place-v1 --thumbnail ./new-cover.png --video ./clip.mp4
171
+ udcli dataset uploads # your uploads and their review state
172
+ udcli dataset set-price franka-pick-place-v1 30
173
+ udcli dataset pending # super admin
174
+ udcli dataset approve franka-pick-place-v1 [--note ...]
175
+ udcli dataset reject franka-pick-place-v1 --reason "..."
176
+ udcli dataset archive franka-pick-place-v1 # off sale; buyers keep access
177
+ ```
178
+
179
+ When `--hf-repo` is given, `udcli` extracts `N` episodes (`--sample-episodes N`, plus optional `--sample-frames`
180
+ to slice each episode), rewrites LeRobot `meta/` counts so the sample loads directly, generates a Dataset Card
181
+ `README.md`, and pushes the free sample to Hugging Face using your local token (`--hf-token`, `HF_TOKEN`, or
182
+ `hf auth login`; never sent to Unidroid). The sample is public, so the files are listed and you confirm before
183
+ they are pushed (`--yes` or `--confirm-rights` skips it), and a paid dataset whose sample would hold every episode
184
+ is refused. Pass `--auto-media` to extract a thumbnail and short preview clip
185
+ from the dataset folder automatically. The full folder is packaged deterministically as a store-only ZIP, uploaded
186
+ to R2 in parallel parts (`--jobs`), and resumes without re-zipping when you run the same command again.
187
+
188
+ ## Development
189
+
190
+ ```bash
191
+ pip install -e ".[dev]"
192
+ pytest
193
+ ```
194
+
195
+ `tests/protocol_vectors.json` is copied from `unidroid-backend`. `tests/test_backend_e2e.py` runs
196
+ against the real backend when it's installed alongside, and is skipped otherwise.
@@ -0,0 +1,177 @@
1
+ # udcli - Unidroid CLI
2
+
3
+ Submit robotics models (VLAs, WAMs, world models) to [Unidroid](https://unidroid.ai) challenges,
4
+ manage your account, evaluate locally and use BenchHub.
5
+
6
+ ```bash
7
+ pip install unidroid-cli # core
8
+ pip install "unidroid-cli[wallet]" # needed for submission submit / account coldkey register
9
+ ```
10
+
11
+ Env: `UNIDROID_API_URL` (`https://api.unidroid.ai`), `UNIDROID_API_KEY`, `UNIDROID_HOME` (`~/.unidroid`),
12
+ `UNIDROID_CACHE_DIR` (`~/.unidroid/bench-cache`), `HF_TOKEN`. Without `UNIDROID_API_URL` or `--api-url`,
13
+ `udcli` talks to `https://api.unidroid.ai`. `~/.unidroid/credentials.json` is written atomically and limited to
14
+ your user.
15
+
16
+ Commands that cannot be undone (`account coldkey remove`, `auth keys delete`, `dataset discard`,
17
+ `dataset archive`) ask first; pass `--yes` / `-y` to skip the question in scripts.
18
+
19
+ ## Commands
20
+
21
+ Commands are grouped by what they act on, like the Hugging Face `hf` CLI. `udcli <group>` (or `-h` at any level)
22
+ lists what a group can do.
23
+
24
+ | Group | Commands | For |
25
+ | --- | --- | --- |
26
+ | `auth` | `login`, `logout`, `whoami`, `keys list\|create\|revoke\|delete`, `hf set\|status\|remove` | Who you are, API keys, the Hugging Face read token |
27
+ | `account` | `balance`, `ledger`, `claim`, `coldkey list\|register\|remove` | Platform balance, TAO deposits, coldkeys |
28
+ | `challenge` | `list`, `show`, `leaderboard` | Browsing challenges |
29
+ | `submission` | `hash`, `push`, `check`, `eval`, `submit`, `resume`, `list`, `show` | Your entries, from preparing to results |
30
+ | `bench` | `list`, `info`, `download`, `upload`, `link`, `status`, `cache list\|info\|clear` | BenchHub benchmarks |
31
+ | `dataset` | `list`, `info`, `mine`, `buy`, `download`, `upload`, `media`, `uploads`, `discard`, `set-price`, `edit`, `pending`, `approve`, `reject`, `archive`, `restore` | Datasets for sale |
32
+ | `validator` | `pending`, `fetch` | Validator accounts |
33
+
34
+ `--api-key` and `--api-url` work on every command, before or after the subcommand. They apply only to
35
+ that run, so you can use another account without `udcli auth login` and without replacing the saved key.
36
+ `UNIDROID_API_KEY` does the same when the flag is omitted. List commands accept `--json`.
37
+
38
+ ## Miner quick start
39
+
40
+ ```bash
41
+ udcli auth login # optional: save an API key from unidroid.ai/account/api-keys
42
+ udcli account balance --api-key unidroid_... # or pass the key on any command; overrides login
43
+ udcli auth hf set # read-only HF token for validators
44
+ udcli account coldkey register --wallet miner
45
+ udcli account coldkey remove <ss58> # or: --wallet miner
46
+ udcli account balance # shows the address to send TAO to
47
+ # After transferring TAO from that coldkey:
48
+ udcli account claim 9092713-0006 # extrinsic id from the block explorer
49
+
50
+ udcli challenge list
51
+ udcli challenge show pi05-libero-s1
52
+ udcli submission hash --path ./my-submission
53
+ udcli submission check --path ./my-submission --challenge pi05-libero-s1
54
+ udcli submission eval --challenge pi05-libero-s1 --hf-repo you/pi05-libero # docker + GPU, same sandbox as validators
55
+ udcli submission eval --challenge pi05-libero-s1 --model-dir ./model # a local model folder, mounted at /model
56
+ udcli submission submit --path ./my-submission --hf-repo you/pi05-libero --challenge pi05-libero-s1 \
57
+ --wallet miner --hotkey default
58
+ udcli submission list
59
+ udcli submission show 42 # each validator's status, score, error, success rate, episodes
60
+ udcli submission show 42 --compare udcli-eval-pi05-libero-s1-<ts>/out/results.json
61
+ udcli challenge leaderboard pi05-libero-s1
62
+ ```
63
+
64
+ `submission eval` runs the public eval config on the challenge's public benchmarks in the validator sandbox.
65
+ `submission show --compare` puts that local `results.json` next to what validators reported: the score, the
66
+ success rate and episode count, and whether your run used the same eval config (by sha256).
67
+
68
+ Every submission is a folder: `agent.yaml`, `brain/`, `train/`, optional `tests/` and `docs/`, and `weights/`.
69
+ Weights go to your own Hugging Face repo; the rest goes to Unidroid as one deterministic ZIP. `agent.yaml` lists
70
+ the sha256 of every file under `weights/`, and the hotkey signs those hashes with the ZIP's hash. Keep the pinned
71
+ commit available and unchanged until Review ends, or you're disqualified. Winners are copied to Unidroid's HF org
72
+ before payout; the published copy also holds the ZIP.
73
+
74
+ ```bash
75
+ udcli submission hash --path ./my-submission # (re)write the weights: block of agent.yaml
76
+ udcli submission hash --path ./my-submission --check # verify only
77
+ udcli submission check --path ./my-submission --challenge pi05-franka-s1
78
+ udcli submission push --path ./my-submission --hf-repo you/pi05-weights # optional: push weights/ on its own
79
+ udcli submission submit --path ./my-submission --hf-repo you/pi05-weights --challenge pi05-franka-s1 \
80
+ --wallet miner --hotkey default
81
+ udcli submission resume <upload-id> # finish an interrupted upload (24 hours)
82
+ ```
83
+
84
+ `submission submit` pushes `weights/` with your local Hugging Face login (`HF_TOKEN` or `hf auth login`;
85
+ it never leaves your machine), creating a private repo when missing and skipping the push when `main`
86
+ already holds the same files. It then pins the commit, compares it with `agent.yaml`, builds the ZIP and
87
+ uploads it. The publication terms and the fee are shown first: nothing is pushed to Hugging Face until you accept,
88
+ and any files on `main` that `agent.yaml` does not declare are listed before they are removed. Interrupted
89
+ uploads resume without re-sending finished parts. `--skip-upload --revision <sha>` uses weights you pushed
90
+ yourself (`--revision` is only valid with `--skip-upload`), `--write-hashes` rewrites stale
91
+ hashes without asking. Validators download with the read token saved by `udcli auth hf set`; it must belong
92
+ to the repo owner and must not be able to write. The fee is charged when the upload completes. `.DS_Store`,
93
+ `Thumbs.db`, swap and backup files, `.cache/`, `.git/` and `__pycache__/` are never hashed or uploaded; any
94
+ other dot file under `weights/` is refused.
95
+
96
+ ## Validators
97
+
98
+ ```bash
99
+ udcli validator pending [--challenge pi05-franka-s1]
100
+ udcli validator fetch 42 --out ./submission-42 # every hash checked against what the miner signed
101
+ ```
102
+
103
+ ## BenchHub
104
+
105
+ ```bash
106
+ udcli bench list [--category manipulation] [--visibility public]
107
+ udcli bench info libero-spatial
108
+ udcli bench download libero-spatial # sha256-verified, cached
109
+ udcli bench upload ./my-bench --visibility private [--thumbnail cover.png] # team role
110
+ udcli bench link franka-tabletop-v13 --visibility private # admin, Nepher EnvHub
111
+ udcli bench status
112
+ udcli bench cache list | info | clear [id]
113
+ ```
114
+
115
+ A benchmark is either uploaded to R2 or linked from the Nepher EnvHub. `bench link` is admin only: it takes an
116
+ EnvHub environment id, and the server reads that bundle's `manifest.yaml` as the BenchHub record. The bundle
117
+ stays on EnvHub and the server pins its current sha256. Downloads work the same for both: the API checks access
118
+ and returns a short-lived URL, and EnvHub bundles are streamed through the Unidroid API. You never need a Nepher
119
+ API key.
120
+
121
+ - **Public**: any logged-in user.
122
+ - **Private**: validators and the uploading team, only during the active window (UTC). Never miners.
123
+ - **Admins**: always.
124
+
125
+ A bundle needs `manifest.yaml` with `id`, `name`, `category`, `format`,
126
+ `description`. Optional: `robot` (for example `franka-panda`) and `robot_type` (any string, for example
127
+ `arm` or `humanoid`). Put any revision in the id. A benchmark id is immutable.
128
+
129
+ ## Datasets
130
+
131
+ Robot datasets for training VLA models. Anyone can browse; buying and downloading need `udcli auth login`.
132
+
133
+ ```bash
134
+ udcli dataset list [--search franka] [--free] [--sort popular]
135
+ udcli dataset info franka-pick-place-v1 # price, size, license, Hugging Face preview, what you may do
136
+ udcli dataset buy franka-pick-place-v1 # pays from your balance (see: udcli account balance)
137
+ udcli dataset download franka-pick-place-v1 [--out ./data] [--extract]
138
+ udcli dataset mine
139
+ ```
140
+
141
+ Downloads resume after an interruption and are checked against the published sha256. Archives are unpacked
142
+ safely: nothing leaves the target folder.
143
+
144
+ Admins upload and price datasets; a super admin approves an admin's upload (a super admin's own upload goes on
145
+ sale once verified):
146
+
147
+ ```bash
148
+ udcli dataset upload ./my-dataset --id franka-pick-place-v1 --license CC-BY-4.0 --price 25 \
149
+ --robot franka-panda --hf-repo unidroid/franka-pick-place-v1-sample --sample-episodes 3 \
150
+ --thumbnail ./cover.png --video ./preview.mp4
151
+ udcli dataset media franka-pick-place-v1 --thumbnail ./new-cover.png --video ./clip.mp4
152
+ udcli dataset uploads # your uploads and their review state
153
+ udcli dataset set-price franka-pick-place-v1 30
154
+ udcli dataset pending # super admin
155
+ udcli dataset approve franka-pick-place-v1 [--note ...]
156
+ udcli dataset reject franka-pick-place-v1 --reason "..."
157
+ udcli dataset archive franka-pick-place-v1 # off sale; buyers keep access
158
+ ```
159
+
160
+ When `--hf-repo` is given, `udcli` extracts `N` episodes (`--sample-episodes N`, plus optional `--sample-frames`
161
+ to slice each episode), rewrites LeRobot `meta/` counts so the sample loads directly, generates a Dataset Card
162
+ `README.md`, and pushes the free sample to Hugging Face using your local token (`--hf-token`, `HF_TOKEN`, or
163
+ `hf auth login`; never sent to Unidroid). The sample is public, so the files are listed and you confirm before
164
+ they are pushed (`--yes` or `--confirm-rights` skips it), and a paid dataset whose sample would hold every episode
165
+ is refused. Pass `--auto-media` to extract a thumbnail and short preview clip
166
+ from the dataset folder automatically. The full folder is packaged deterministically as a store-only ZIP, uploaded
167
+ to R2 in parallel parts (`--jobs`), and resumes without re-zipping when you run the same command again.
168
+
169
+ ## Development
170
+
171
+ ```bash
172
+ pip install -e ".[dev]"
173
+ pytest
174
+ ```
175
+
176
+ `tests/protocol_vectors.json` is copied from `unidroid-backend`. `tests/test_backend_e2e.py` runs
177
+ against the real backend when it's installed alongside, and is skipped otherwise.
@@ -0,0 +1,40 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "unidroid-cli"
7
+ dynamic = ["version"]
8
+ description = "udcli - the Unidroid command line: auth, account, challenge, submission, bench, dataset and validator"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ dependencies = [
13
+ "httpx>=0.27",
14
+ "typer>=0.12",
15
+ "rich>=13",
16
+ "huggingface_hub>=0.25",
17
+ "pyyaml>=6",
18
+ ]
19
+
20
+ [project.optional-dependencies]
21
+ # Needed for `submission submit` and `account coldkey register` (hotkey/coldkey signing).
22
+ wallet = ["bittensor-wallet>=4.0"]
23
+ dev = ["pytest>=8", "py-sr25519-bindings>=0.2", "ruff>=0.4"]
24
+
25
+ [project.scripts]
26
+ udcli = "unidroid_cli.cli:main"
27
+
28
+ [tool.hatch.version]
29
+ path = "src/unidroid_cli/__init__.py"
30
+
31
+ [tool.hatch.build.targets.wheel]
32
+ packages = ["src/unidroid_cli"]
33
+
34
+ [tool.ruff]
35
+ line-length = 110
36
+ target-version = "py310"
37
+
38
+ [tool.pytest.ini_options]
39
+ testpaths = ["tests"]
40
+ pythonpath = ["src"]
@@ -0,0 +1 @@
1
+ __version__ = "0.3.0"
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ main()
@@ -0,0 +1,74 @@
1
+ """State and helpers shared by every udcli command group."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from datetime import datetime
7
+
8
+ import typer
9
+ from rich.console import Console
10
+
11
+ from .http import Api, ApiError
12
+
13
+ console = Console()
14
+ err = Console(stderr=True)
15
+
16
+ STATE: dict = {"api_url": None, "api_key": None}
17
+
18
+ CONTEXT = {"help_option_names": ["-h", "--help"]}
19
+
20
+ TAO = 1_000_000_000
21
+
22
+
23
+ def group(help: str) -> typer.Typer:
24
+ """A command group: `udcli <group>` with no subcommand prints its help."""
25
+ return typer.Typer(help=help, no_args_is_help=True, context_settings=CONTEXT)
26
+
27
+
28
+ def api(require_key: bool = True) -> Api:
29
+ return Api(STATE["api_url"], STATE["api_key"], require_key=require_key)
30
+
31
+
32
+ YES = typer.Option(False, "--yes", "-y", help="Do not ask to confirm.")
33
+
34
+
35
+ def confirm(question: str, yes: bool) -> None:
36
+ """Ask before something that cannot be undone; exits when the answer is no."""
37
+ if not yes:
38
+ typer.confirm(question, abort=True)
39
+
40
+
41
+ def tao(rao: int) -> str:
42
+ return f"{rao / TAO:.4f} TAO"
43
+
44
+
45
+ def local_time(iso: str | None) -> str:
46
+ if not iso:
47
+ return "-"
48
+ return datetime.fromisoformat(iso.replace("Z", "+00:00")).astimezone().strftime("%Y-%m-%d %H:%M %Z")
49
+
50
+
51
+ def emit_json(data) -> None:
52
+ console.print_json(json.dumps(data))
53
+
54
+
55
+ def pick_challenge(client: Api, challenge_id: str | None) -> dict:
56
+ if challenge_id:
57
+ return client.get(f"/v1/challenges/{challenge_id}")
58
+ open_ = [c for c in client.get("/v1/challenges", params={"status": "active"}) if c["accepting_submissions"]]
59
+ if len(open_) == 1:
60
+ return client.get(f"/v1/challenges/{open_[0]['id']}")
61
+ ids = ", ".join(c["id"] for c in open_) or "none"
62
+ raise ApiError(400, f"pass --challenge (challenges accepting submissions: {ids})")
63
+
64
+
65
+ def report(problems: list[str]) -> None:
66
+ if problems:
67
+ for p in problems:
68
+ err.print(f"[red]x[/red] {p}")
69
+ raise typer.Exit(1)
70
+ console.print("[green]All checks passed.[/green]")
71
+
72
+
73
+ def hash_progress(path: str, done: int, total: int) -> None:
74
+ console.print(f" hashing {done}/{total} weights/{path}", markup=False, highlight=False)