hivelab 0.1.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.
- hivelab-0.1.0/.gitignore +7 -0
- hivelab-0.1.0/PKG-INFO +169 -0
- hivelab-0.1.0/README.md +151 -0
- hivelab-0.1.0/hivelab/__init__.py +3 -0
- hivelab-0.1.0/hivelab/__main__.py +4 -0
- hivelab-0.1.0/hivelab/cli.py +747 -0
- hivelab-0.1.0/hivelab/client.py +158 -0
- hivelab-0.1.0/hivelab/config.py +109 -0
- hivelab-0.1.0/hivelab/loader.py +220 -0
- hivelab-0.1.0/pyproject.toml +32 -0
hivelab-0.1.0/.gitignore
ADDED
hivelab-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hivelab
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Command-line tool for pushing structured Markdown research notes to any hivelab-compatible backend.
|
|
5
|
+
Author: hivelab
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: cli,experiment-tracking,markdown,notes,research
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Requires-Dist: click>=8.1
|
|
15
|
+
Requires-Dist: requests>=2.31
|
|
16
|
+
Requires-Dist: rich>=13.7
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# hivelab
|
|
20
|
+
|
|
21
|
+
Command-line tool for pushing structured Markdown research notes to any **hivelab-compatible** backend.
|
|
22
|
+
|
|
23
|
+
`hivelab` is generic — it doesn't care what you're researching (ML, wet lab, journalism, anything). It speaks one protocol: `POST /api/v1/experiments` with a Markdown body, an optional template name, and optional thread name. The backend is responsible for parsing/extracting/storing.
|
|
24
|
+
|
|
25
|
+
Reference backend: [hive-lab](../hive-lab/). Any server that implements the same `/api/v1/*` endpoints works.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install hivelab # PyPI (when published)
|
|
31
|
+
# or, from source:
|
|
32
|
+
pip install -e /path/to/hivelab
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Two entrypoints: `hivelab` and the short alias `hl`.
|
|
36
|
+
|
|
37
|
+
## Quick start
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# 1. Save your backend URL + token
|
|
41
|
+
hivelab login
|
|
42
|
+
# Backend URL [http://localhost:3000]: …
|
|
43
|
+
# API token (lab_…): ************
|
|
44
|
+
# ✓ 已保存 profile default, 登录身份:Bob (bob) @ http://localhost:3000
|
|
45
|
+
|
|
46
|
+
# 2. See what you have access to
|
|
47
|
+
hivelab projects
|
|
48
|
+
hivelab templates concordia
|
|
49
|
+
|
|
50
|
+
# 3. Push a single .md file
|
|
51
|
+
hivelab push ./run-42.md --project concordia --template "ML 训练"
|
|
52
|
+
|
|
53
|
+
# 4. Push a whole run directory (auto-picks summary.md / notes.md / README.md,
|
|
54
|
+
# attaches config.json / metrics.json so the LLM can extract fields from them)
|
|
55
|
+
hivelab push ./runs/exp-042/ --project concordia --template "ML 训练"
|
|
56
|
+
|
|
57
|
+
# 5. Drop a quick idea
|
|
58
|
+
hivelab note "明天试试在 P2 任务上加个 MoE 路由器" --project concordia
|
|
59
|
+
|
|
60
|
+
# 6. Check this week's digest
|
|
61
|
+
hivelab digest --week current
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Commands
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
# Auth / context
|
|
68
|
+
hivelab login [--url URL] [--token TOKEN] [--name PROFILE] [--set-default]
|
|
69
|
+
hivelab logout [--name PROFILE]
|
|
70
|
+
hivelab profiles # list all configured backends
|
|
71
|
+
hivelab whoami # check who you're logged in as
|
|
72
|
+
hivelab projects # list projects
|
|
73
|
+
hivelab templates <project> # show templates + threads for a project
|
|
74
|
+
|
|
75
|
+
# Push content
|
|
76
|
+
hivelab push <path> --project X [--template Y] [--thread Z]
|
|
77
|
+
[--title T] [--field name=value]... [--publish | --draft]
|
|
78
|
+
[--no-llm] [--dry-run]
|
|
79
|
+
hivelab note "text..." --project X [--title T]
|
|
80
|
+
|
|
81
|
+
# Todos
|
|
82
|
+
hivelab todo list [--scope me|project] [-P slug] [--status open|done|all]
|
|
83
|
+
hivelab todo add "title" -P slug [--assign username] [--due YYYY-MM-DD] [--thread id] [--desc "..."]
|
|
84
|
+
hivelab todo done <id_or_prefix> # mark complete
|
|
85
|
+
hivelab todo reopen <id_or_prefix>
|
|
86
|
+
hivelab todo drop <id_or_prefix>
|
|
87
|
+
|
|
88
|
+
# Read / search
|
|
89
|
+
hivelab search "query" # cross-search experiments/notes/todos/threads
|
|
90
|
+
hivelab digest [--week current|previous|YYYY-MM-DD] [--json]
|
|
91
|
+
hivelab notif [--all] [--read]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Use `hivelab <cmd> --help` for full per-command help.
|
|
95
|
+
|
|
96
|
+
### `push` modes
|
|
97
|
+
|
|
98
|
+
| Mode | When | Behavior |
|
|
99
|
+
|------|------|----------|
|
|
100
|
+
| LLM-extracted (default) | `--template T` given, no `--field` overrides | Backend runs Claude to extract fields from the Markdown. Saves as **draft** for web review. |
|
|
101
|
+
| Direct (bypass LLM) | `--field key=value` overrides | Listed fields go straight in, no LLM call for them. Combine with `--no-llm` to skip LLM entirely. Default status is **published**. |
|
|
102
|
+
| Note (no template) | use `hivelab note` instead | Plain Markdown, no structured fields, always published. |
|
|
103
|
+
|
|
104
|
+
### Field overrides
|
|
105
|
+
|
|
106
|
+
If your training script already knows the numbers, pass them directly — no need to round-trip through the LLM:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
hivelab push ./run/notes.md \
|
|
110
|
+
--project concordia --template "ML 训练" --thread "P1 ablation" \
|
|
111
|
+
--field model=llama-3-8b \
|
|
112
|
+
--field lr=5e-4 \
|
|
113
|
+
--field seed=42 \
|
|
114
|
+
--field metric_acc=87.3 \
|
|
115
|
+
--publish
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Booleans and numbers are auto-coerced (`true`/`false`, `0.001`, `42`); everything else is treated as a string.
|
|
119
|
+
|
|
120
|
+
## Profiles (multi-backend)
|
|
121
|
+
|
|
122
|
+
Most users only need one backend; the default profile is just called `default`. For multiple backends:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
hivelab login --name local --url http://localhost:3000 --token lab_xxx --set-default
|
|
126
|
+
hivelab login --name prod --url https://research.example.com --token lab_yyy
|
|
127
|
+
|
|
128
|
+
hivelab projects # uses default profile
|
|
129
|
+
hivelab -p prod projects # uses 'prod' profile
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Environment variable override (useful in CI):
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
HIVELAB_URL=https://research.example.com HIVELAB_TOKEN=lab_xxx hivelab push ...
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Config file location: `~/.config/hivelab/config.json` (mode `0600`).
|
|
139
|
+
|
|
140
|
+
## In Python scripts (no shell)
|
|
141
|
+
|
|
142
|
+
There's no Python SDK yet — that's a v2 candidate. For now, call the protocol directly:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
import requests
|
|
146
|
+
|
|
147
|
+
requests.post(
|
|
148
|
+
"http://localhost:3000/api/v1/experiments",
|
|
149
|
+
headers={"Authorization": f"Bearer {token}"},
|
|
150
|
+
json={
|
|
151
|
+
"project": "concordia",
|
|
152
|
+
"template": "ML 训练",
|
|
153
|
+
"thread": "P1 ablation",
|
|
154
|
+
"title": f"lr={lr}, seed={seed}",
|
|
155
|
+
"markdown": notebook_summary,
|
|
156
|
+
"structuredFields": {
|
|
157
|
+
"model": {"value": "llama-3-8b", "confidence": 1, "edited": True},
|
|
158
|
+
"lr": {"value": lr, "confidence": 1, "edited": True},
|
|
159
|
+
"seed": {"value": seed, "confidence": 1, "edited": True},
|
|
160
|
+
"metric_acc": {"value": acc, "confidence": 1, "edited": True},
|
|
161
|
+
},
|
|
162
|
+
"status": "published",
|
|
163
|
+
},
|
|
164
|
+
).raise_for_status()
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT.
|
hivelab-0.1.0/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# hivelab
|
|
2
|
+
|
|
3
|
+
Command-line tool for pushing structured Markdown research notes to any **hivelab-compatible** backend.
|
|
4
|
+
|
|
5
|
+
`hivelab` is generic — it doesn't care what you're researching (ML, wet lab, journalism, anything). It speaks one protocol: `POST /api/v1/experiments` with a Markdown body, an optional template name, and optional thread name. The backend is responsible for parsing/extracting/storing.
|
|
6
|
+
|
|
7
|
+
Reference backend: [hive-lab](../hive-lab/). Any server that implements the same `/api/v1/*` endpoints works.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install hivelab # PyPI (when published)
|
|
13
|
+
# or, from source:
|
|
14
|
+
pip install -e /path/to/hivelab
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Two entrypoints: `hivelab` and the short alias `hl`.
|
|
18
|
+
|
|
19
|
+
## Quick start
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# 1. Save your backend URL + token
|
|
23
|
+
hivelab login
|
|
24
|
+
# Backend URL [http://localhost:3000]: …
|
|
25
|
+
# API token (lab_…): ************
|
|
26
|
+
# ✓ 已保存 profile default, 登录身份:Bob (bob) @ http://localhost:3000
|
|
27
|
+
|
|
28
|
+
# 2. See what you have access to
|
|
29
|
+
hivelab projects
|
|
30
|
+
hivelab templates concordia
|
|
31
|
+
|
|
32
|
+
# 3. Push a single .md file
|
|
33
|
+
hivelab push ./run-42.md --project concordia --template "ML 训练"
|
|
34
|
+
|
|
35
|
+
# 4. Push a whole run directory (auto-picks summary.md / notes.md / README.md,
|
|
36
|
+
# attaches config.json / metrics.json so the LLM can extract fields from them)
|
|
37
|
+
hivelab push ./runs/exp-042/ --project concordia --template "ML 训练"
|
|
38
|
+
|
|
39
|
+
# 5. Drop a quick idea
|
|
40
|
+
hivelab note "明天试试在 P2 任务上加个 MoE 路由器" --project concordia
|
|
41
|
+
|
|
42
|
+
# 6. Check this week's digest
|
|
43
|
+
hivelab digest --week current
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Commands
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
# Auth / context
|
|
50
|
+
hivelab login [--url URL] [--token TOKEN] [--name PROFILE] [--set-default]
|
|
51
|
+
hivelab logout [--name PROFILE]
|
|
52
|
+
hivelab profiles # list all configured backends
|
|
53
|
+
hivelab whoami # check who you're logged in as
|
|
54
|
+
hivelab projects # list projects
|
|
55
|
+
hivelab templates <project> # show templates + threads for a project
|
|
56
|
+
|
|
57
|
+
# Push content
|
|
58
|
+
hivelab push <path> --project X [--template Y] [--thread Z]
|
|
59
|
+
[--title T] [--field name=value]... [--publish | --draft]
|
|
60
|
+
[--no-llm] [--dry-run]
|
|
61
|
+
hivelab note "text..." --project X [--title T]
|
|
62
|
+
|
|
63
|
+
# Todos
|
|
64
|
+
hivelab todo list [--scope me|project] [-P slug] [--status open|done|all]
|
|
65
|
+
hivelab todo add "title" -P slug [--assign username] [--due YYYY-MM-DD] [--thread id] [--desc "..."]
|
|
66
|
+
hivelab todo done <id_or_prefix> # mark complete
|
|
67
|
+
hivelab todo reopen <id_or_prefix>
|
|
68
|
+
hivelab todo drop <id_or_prefix>
|
|
69
|
+
|
|
70
|
+
# Read / search
|
|
71
|
+
hivelab search "query" # cross-search experiments/notes/todos/threads
|
|
72
|
+
hivelab digest [--week current|previous|YYYY-MM-DD] [--json]
|
|
73
|
+
hivelab notif [--all] [--read]
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Use `hivelab <cmd> --help` for full per-command help.
|
|
77
|
+
|
|
78
|
+
### `push` modes
|
|
79
|
+
|
|
80
|
+
| Mode | When | Behavior |
|
|
81
|
+
|------|------|----------|
|
|
82
|
+
| LLM-extracted (default) | `--template T` given, no `--field` overrides | Backend runs Claude to extract fields from the Markdown. Saves as **draft** for web review. |
|
|
83
|
+
| Direct (bypass LLM) | `--field key=value` overrides | Listed fields go straight in, no LLM call for them. Combine with `--no-llm` to skip LLM entirely. Default status is **published**. |
|
|
84
|
+
| Note (no template) | use `hivelab note` instead | Plain Markdown, no structured fields, always published. |
|
|
85
|
+
|
|
86
|
+
### Field overrides
|
|
87
|
+
|
|
88
|
+
If your training script already knows the numbers, pass them directly — no need to round-trip through the LLM:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
hivelab push ./run/notes.md \
|
|
92
|
+
--project concordia --template "ML 训练" --thread "P1 ablation" \
|
|
93
|
+
--field model=llama-3-8b \
|
|
94
|
+
--field lr=5e-4 \
|
|
95
|
+
--field seed=42 \
|
|
96
|
+
--field metric_acc=87.3 \
|
|
97
|
+
--publish
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Booleans and numbers are auto-coerced (`true`/`false`, `0.001`, `42`); everything else is treated as a string.
|
|
101
|
+
|
|
102
|
+
## Profiles (multi-backend)
|
|
103
|
+
|
|
104
|
+
Most users only need one backend; the default profile is just called `default`. For multiple backends:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
hivelab login --name local --url http://localhost:3000 --token lab_xxx --set-default
|
|
108
|
+
hivelab login --name prod --url https://research.example.com --token lab_yyy
|
|
109
|
+
|
|
110
|
+
hivelab projects # uses default profile
|
|
111
|
+
hivelab -p prod projects # uses 'prod' profile
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Environment variable override (useful in CI):
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
HIVELAB_URL=https://research.example.com HIVELAB_TOKEN=lab_xxx hivelab push ...
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Config file location: `~/.config/hivelab/config.json` (mode `0600`).
|
|
121
|
+
|
|
122
|
+
## In Python scripts (no shell)
|
|
123
|
+
|
|
124
|
+
There's no Python SDK yet — that's a v2 candidate. For now, call the protocol directly:
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
import requests
|
|
128
|
+
|
|
129
|
+
requests.post(
|
|
130
|
+
"http://localhost:3000/api/v1/experiments",
|
|
131
|
+
headers={"Authorization": f"Bearer {token}"},
|
|
132
|
+
json={
|
|
133
|
+
"project": "concordia",
|
|
134
|
+
"template": "ML 训练",
|
|
135
|
+
"thread": "P1 ablation",
|
|
136
|
+
"title": f"lr={lr}, seed={seed}",
|
|
137
|
+
"markdown": notebook_summary,
|
|
138
|
+
"structuredFields": {
|
|
139
|
+
"model": {"value": "llama-3-8b", "confidence": 1, "edited": True},
|
|
140
|
+
"lr": {"value": lr, "confidence": 1, "edited": True},
|
|
141
|
+
"seed": {"value": seed, "confidence": 1, "edited": True},
|
|
142
|
+
"metric_acc": {"value": acc, "confidence": 1, "edited": True},
|
|
143
|
+
},
|
|
144
|
+
"status": "published",
|
|
145
|
+
},
|
|
146
|
+
).raise_for_status()
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MIT.
|