outo-models-cli 0.2.2__tar.gz → 0.2.4__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.
- outo_models_cli-0.2.4/PKG-INFO +166 -0
- outo_models_cli-0.2.4/README.md +135 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/pyproject.toml +1 -1
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/api/lfs_batch.py +2 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/api/lfs_upload.py +2 -1
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/api/upload.py +2 -0
- outo_models_cli-0.2.4/src/outo_models_cli/commands/_help_text/__init__.py +132 -0
- outo_models_cli-0.2.4/src/outo_models_cli/commands/_help_text/_auth.py +38 -0
- outo_models_cli-0.2.4/src/outo_models_cli/commands/_help_text/_auth_cmds.py +296 -0
- outo_models_cli-0.2.4/src/outo_models_cli/commands/_help_text/_common.py +82 -0
- outo_models_cli-0.2.4/src/outo_models_cli/commands/_help_text/_repo.py +226 -0
- outo_models_cli-0.2.4/src/outo_models_cli/commands/_help_text/_root.py +180 -0
- outo_models_cli-0.2.4/src/outo_models_cli/commands/_help_text/_transfer.py +277 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/commands/auth.py +48 -9
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/commands/download.py +12 -1
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/commands/ls.py +14 -2
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/commands/repo.py +42 -8
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/commands/upload.py +12 -1
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/errors.py +12 -4
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/http.py +13 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/main.py +63 -9
- outo_models_cli-0.2.4/tests/test_cli_help.py +335 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_errors.py +23 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/uv.lock +1 -1
- outo_models_cli-0.2.2/PKG-INFO +0 -111
- outo_models_cli-0.2.2/README.md +0 -80
- outo_models_cli-0.2.2/tests/test_cli_help.py +0 -72
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/.gitignore +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/LICENSE +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/__init__.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/__main__.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/api/__init__.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/api/auth.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/api/lfs.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/api/repos.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/commands/__init__.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/commands/_shared.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/commands/_upload_commit.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/config.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/downloader/__init__.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/downloader/transfer.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/downloader/walk.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/src/outo_models_cli/matchers.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/conftest.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_api_crud.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_api_upload.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_cli_auth.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_cli_errors.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_cli_repo.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_cli_upload_lfs.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_cli_xfer.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_config.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_download_lfs.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_download_repo.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_download_transfer.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_download_walk.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_lfs.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_lfs_upload.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_matchers.py +0 -0
- {outo_models_cli-0.2.2 → outo_models_cli-0.2.4}/tests/test_upload_commit.py +0 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: outo-models-cli
|
|
3
|
+
Version: 0.2.4
|
|
4
|
+
Summary: Command-line client for self-hosted outo-models servers — auth, repo, download, and upload.
|
|
5
|
+
Project-URL: Homepage, https://github.com/outo-models/outo-models
|
|
6
|
+
Project-URL: Documentation, https://github.com/outo-models/outo-models/blob/main/omc/README.md
|
|
7
|
+
Project-URL: Repository, https://github.com/outo-models/outo-models
|
|
8
|
+
Project-URL: Issues, https://github.com/outo-models/outo-models/issues
|
|
9
|
+
Author: outo-models developers
|
|
10
|
+
License: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: cli,huggingface,model-hub,outo-models,self-hosted
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: <3.13,>=3.12
|
|
26
|
+
Requires-Dist: httpx>=0.27
|
|
27
|
+
Requires-Dist: pydantic>=2.8
|
|
28
|
+
Requires-Dist: rich>=13.7
|
|
29
|
+
Requires-Dist: typer>=0.12
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# outo-models-cli
|
|
33
|
+
|
|
34
|
+
`omc` — the user-facing command-line client for self-hosted
|
|
35
|
+
[outo-models](https://github.com/outo-models/outo-models) servers.
|
|
36
|
+
Hugging Face CLI surface, adapted to a self-hosted multi-server world.
|
|
37
|
+
|
|
38
|
+
The CLI is documented entirely in-band: typing `omc` (bare) or
|
|
39
|
+
`omc --help` prints a comprehensive reference covering PURPOSE,
|
|
40
|
+
CONCEPTS, GETTING STARTED, COMMAND INDEX, CONFIG, and MORE HELP.
|
|
41
|
+
Every subcommand (`omc auth login`, `omc repo create`, `omc upload`,
|
|
42
|
+
...) has the same six-section layout — PURPOSE / USAGE / EXAMPLES /
|
|
43
|
+
EXIT CODES / NOTES — so an AI agent reading one page has the full
|
|
44
|
+
mental model of every other page.
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install outo-models-cli
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Both `omc` and `outo-models-cli` console scripts are installed.
|
|
53
|
+
|
|
54
|
+
## Quickstart (copy-pasteable)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# 1. Log in (prompts for a PAT, masked)
|
|
58
|
+
omc auth login --server https://models.example.com
|
|
59
|
+
|
|
60
|
+
# 2. Verify
|
|
61
|
+
omc auth whoami
|
|
62
|
+
omc auth status
|
|
63
|
+
|
|
64
|
+
# 3. Create a model repo
|
|
65
|
+
omc repo create my-model --kind model --public --description "My first model"
|
|
66
|
+
|
|
67
|
+
# 4. Browse the tree
|
|
68
|
+
omc ls alice/my-model
|
|
69
|
+
|
|
70
|
+
# 5. Download everything
|
|
71
|
+
omc download alice/my-model --local-dir ./my-model
|
|
72
|
+
|
|
73
|
+
# 6. Upload a folder
|
|
74
|
+
omc upload alice/my-model ./checkpoints --path-in-repo weights --message "v1"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Command index
|
|
78
|
+
|
|
79
|
+
| Command | Purpose | Auth |
|
|
80
|
+
| ---------------- | ---------------------------------------------------- | ---- |
|
|
81
|
+
| `omc auth login` | Verify a PAT and store it for one server. | no |
|
|
82
|
+
| `omc auth logout` | Remove the stored credential for one server. | no |
|
|
83
|
+
| `omc auth whoami` | Print user, server, role, and token source. | yes |
|
|
84
|
+
| `omc auth status` | List every configured server and the default one. | no |
|
|
85
|
+
| `omc repo create` | Create a new repository on the target server. | yes |
|
|
86
|
+
| `omc repo delete` | Delete a repository (owner or admin only). | yes |
|
|
87
|
+
| `omc repo list` | List repositories on the target server. | yes |
|
|
88
|
+
| `omc ls` | List one directory of a repository at a revision. | yes |
|
|
89
|
+
| `omc download` | Recursively download a repository (resumable, LFS).| yes |
|
|
90
|
+
| `omc upload` | Upload a file or folder (auto-routes >100 MiB → LFS). | yes |
|
|
91
|
+
|
|
92
|
+
For the full PURPOSE / USAGE / EXAMPLES / EXIT CODES / NOTES reference
|
|
93
|
+
of any command, run `omc <command> --help` (e.g. `omc upload --help`).
|
|
94
|
+
|
|
95
|
+
## Environment variables
|
|
96
|
+
|
|
97
|
+
Every environment variable the CLI reads:
|
|
98
|
+
|
|
99
|
+
* `OMC_SERVER` — server URL override. Highest priority, but below
|
|
100
|
+
the `--server` flag. Never persisted.
|
|
101
|
+
* `OMC_TOKEN` — bearer credential override. Used verbatim, never
|
|
102
|
+
persisted; lets CI jobs run without a config file.
|
|
103
|
+
* `OMC_CONFIG_DIR` — full override for the config directory.
|
|
104
|
+
* `XDG_CONFIG_HOME` — standard XDG base directory (used when
|
|
105
|
+
`OMC_CONFIG_DIR` is unset).
|
|
106
|
+
* `HOME` — fallback (`$HOME/.config/omc`) when neither of the above
|
|
107
|
+
is set.
|
|
108
|
+
|
|
109
|
+
Resolution order (highest priority first):
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
--server flag > OMC_SERVER > default_server in config >
|
|
113
|
+
first server in config file
|
|
114
|
+
OMC_TOKEN > token stored for the resolved server
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Configuration
|
|
118
|
+
|
|
119
|
+
Credentials are stored at `$OMC_CONFIG_DIR/config.json` (defaults to
|
|
120
|
+
`$XDG_CONFIG_HOME/omc/config.json` or `~/.config/omc/config.json`).
|
|
121
|
+
The file has mode `0600`, owned by the current user; the CLI tightens
|
|
122
|
+
the permissions on every save, so a stray `chmod 644` is repaired
|
|
123
|
+
automatically.
|
|
124
|
+
|
|
125
|
+
File shape:
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"default_server": "https://models.example.com",
|
|
130
|
+
"servers": {
|
|
131
|
+
"https://models.example.com": {
|
|
132
|
+
"token": "...",
|
|
133
|
+
"username": "alice"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
URL keys are normalized: trailing slashes stripped, scheme + host
|
|
140
|
+
lower-cased, `http://` prepended when the input carries no scheme.
|
|
141
|
+
|
|
142
|
+
## Git LFS
|
|
143
|
+
|
|
144
|
+
Files larger than 100 MiB are uploaded through Git LFS automatically;
|
|
145
|
+
the CLI partitions the input set, runs the LFS batch + PUT dance for
|
|
146
|
+
each large file, and commits the resulting pointer text alongside any
|
|
147
|
+
small files in a single commit. No `git lfs track` setup is required
|
|
148
|
+
on the user side. The download command follows the same path
|
|
149
|
+
transparently.
|
|
150
|
+
|
|
151
|
+
## Exit codes
|
|
152
|
+
|
|
153
|
+
Every command emits one of:
|
|
154
|
+
|
|
155
|
+
| Code | Meaning |
|
|
156
|
+
| ---- | ----------------------------------------------------------------- |
|
|
157
|
+
| `0` | Success. |
|
|
158
|
+
| `1` | Command failed (network, auth, validation, file system). |
|
|
159
|
+
| `2` | Typer-level usage error (unknown flag, missing required argument).|
|
|
160
|
+
|
|
161
|
+
Re-run with `--debug` to get a full Python traceback instead of the
|
|
162
|
+
single English error line on stderr.
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
Apache-2.0.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# outo-models-cli
|
|
2
|
+
|
|
3
|
+
`omc` — the user-facing command-line client for self-hosted
|
|
4
|
+
[outo-models](https://github.com/outo-models/outo-models) servers.
|
|
5
|
+
Hugging Face CLI surface, adapted to a self-hosted multi-server world.
|
|
6
|
+
|
|
7
|
+
The CLI is documented entirely in-band: typing `omc` (bare) or
|
|
8
|
+
`omc --help` prints a comprehensive reference covering PURPOSE,
|
|
9
|
+
CONCEPTS, GETTING STARTED, COMMAND INDEX, CONFIG, and MORE HELP.
|
|
10
|
+
Every subcommand (`omc auth login`, `omc repo create`, `omc upload`,
|
|
11
|
+
...) has the same six-section layout — PURPOSE / USAGE / EXAMPLES /
|
|
12
|
+
EXIT CODES / NOTES — so an AI agent reading one page has the full
|
|
13
|
+
mental model of every other page.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install outo-models-cli
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Both `omc` and `outo-models-cli` console scripts are installed.
|
|
22
|
+
|
|
23
|
+
## Quickstart (copy-pasteable)
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 1. Log in (prompts for a PAT, masked)
|
|
27
|
+
omc auth login --server https://models.example.com
|
|
28
|
+
|
|
29
|
+
# 2. Verify
|
|
30
|
+
omc auth whoami
|
|
31
|
+
omc auth status
|
|
32
|
+
|
|
33
|
+
# 3. Create a model repo
|
|
34
|
+
omc repo create my-model --kind model --public --description "My first model"
|
|
35
|
+
|
|
36
|
+
# 4. Browse the tree
|
|
37
|
+
omc ls alice/my-model
|
|
38
|
+
|
|
39
|
+
# 5. Download everything
|
|
40
|
+
omc download alice/my-model --local-dir ./my-model
|
|
41
|
+
|
|
42
|
+
# 6. Upload a folder
|
|
43
|
+
omc upload alice/my-model ./checkpoints --path-in-repo weights --message "v1"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Command index
|
|
47
|
+
|
|
48
|
+
| Command | Purpose | Auth |
|
|
49
|
+
| ---------------- | ---------------------------------------------------- | ---- |
|
|
50
|
+
| `omc auth login` | Verify a PAT and store it for one server. | no |
|
|
51
|
+
| `omc auth logout` | Remove the stored credential for one server. | no |
|
|
52
|
+
| `omc auth whoami` | Print user, server, role, and token source. | yes |
|
|
53
|
+
| `omc auth status` | List every configured server and the default one. | no |
|
|
54
|
+
| `omc repo create` | Create a new repository on the target server. | yes |
|
|
55
|
+
| `omc repo delete` | Delete a repository (owner or admin only). | yes |
|
|
56
|
+
| `omc repo list` | List repositories on the target server. | yes |
|
|
57
|
+
| `omc ls` | List one directory of a repository at a revision. | yes |
|
|
58
|
+
| `omc download` | Recursively download a repository (resumable, LFS).| yes |
|
|
59
|
+
| `omc upload` | Upload a file or folder (auto-routes >100 MiB → LFS). | yes |
|
|
60
|
+
|
|
61
|
+
For the full PURPOSE / USAGE / EXAMPLES / EXIT CODES / NOTES reference
|
|
62
|
+
of any command, run `omc <command> --help` (e.g. `omc upload --help`).
|
|
63
|
+
|
|
64
|
+
## Environment variables
|
|
65
|
+
|
|
66
|
+
Every environment variable the CLI reads:
|
|
67
|
+
|
|
68
|
+
* `OMC_SERVER` — server URL override. Highest priority, but below
|
|
69
|
+
the `--server` flag. Never persisted.
|
|
70
|
+
* `OMC_TOKEN` — bearer credential override. Used verbatim, never
|
|
71
|
+
persisted; lets CI jobs run without a config file.
|
|
72
|
+
* `OMC_CONFIG_DIR` — full override for the config directory.
|
|
73
|
+
* `XDG_CONFIG_HOME` — standard XDG base directory (used when
|
|
74
|
+
`OMC_CONFIG_DIR` is unset).
|
|
75
|
+
* `HOME` — fallback (`$HOME/.config/omc`) when neither of the above
|
|
76
|
+
is set.
|
|
77
|
+
|
|
78
|
+
Resolution order (highest priority first):
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
--server flag > OMC_SERVER > default_server in config >
|
|
82
|
+
first server in config file
|
|
83
|
+
OMC_TOKEN > token stored for the resolved server
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Configuration
|
|
87
|
+
|
|
88
|
+
Credentials are stored at `$OMC_CONFIG_DIR/config.json` (defaults to
|
|
89
|
+
`$XDG_CONFIG_HOME/omc/config.json` or `~/.config/omc/config.json`).
|
|
90
|
+
The file has mode `0600`, owned by the current user; the CLI tightens
|
|
91
|
+
the permissions on every save, so a stray `chmod 644` is repaired
|
|
92
|
+
automatically.
|
|
93
|
+
|
|
94
|
+
File shape:
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"default_server": "https://models.example.com",
|
|
99
|
+
"servers": {
|
|
100
|
+
"https://models.example.com": {
|
|
101
|
+
"token": "...",
|
|
102
|
+
"username": "alice"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
URL keys are normalized: trailing slashes stripped, scheme + host
|
|
109
|
+
lower-cased, `http://` prepended when the input carries no scheme.
|
|
110
|
+
|
|
111
|
+
## Git LFS
|
|
112
|
+
|
|
113
|
+
Files larger than 100 MiB are uploaded through Git LFS automatically;
|
|
114
|
+
the CLI partitions the input set, runs the LFS batch + PUT dance for
|
|
115
|
+
each large file, and commits the resulting pointer text alongside any
|
|
116
|
+
small files in a single commit. No `git lfs track` setup is required
|
|
117
|
+
on the user side. The download command follows the same path
|
|
118
|
+
transparently.
|
|
119
|
+
|
|
120
|
+
## Exit codes
|
|
121
|
+
|
|
122
|
+
Every command emits one of:
|
|
123
|
+
|
|
124
|
+
| Code | Meaning |
|
|
125
|
+
| ---- | ----------------------------------------------------------------- |
|
|
126
|
+
| `0` | Success. |
|
|
127
|
+
| `1` | Command failed (network, auth, validation, file system). |
|
|
128
|
+
| `2` | Typer-level usage error (unknown flag, missing required argument).|
|
|
129
|
+
|
|
130
|
+
Re-run with `--debug` to get a full Python traceback instead of the
|
|
131
|
+
single English error line on stderr.
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
Apache-2.0.
|
|
@@ -23,6 +23,7 @@ import httpx
|
|
|
23
23
|
from outo_models_cli.api import send, unwrap
|
|
24
24
|
from outo_models_cli.api.lfs import LFS_CONTENT_TYPE
|
|
25
25
|
from outo_models_cli.errors import BadResponseError, map_response_error
|
|
26
|
+
from outo_models_cli.http import TIMEOUT_BATCH
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
@dataclass(frozen=True, slots=True)
|
|
@@ -72,6 +73,7 @@ def batch_upload(
|
|
|
72
73
|
f"/{owner}/{name}.git/info/lfs/objects/batch",
|
|
73
74
|
headers={"Accept": LFS_CONTENT_TYPE, "Content-Type": LFS_CONTENT_TYPE},
|
|
74
75
|
json=body,
|
|
76
|
+
timeout=TIMEOUT_BATCH,
|
|
75
77
|
)
|
|
76
78
|
if response.status_code == 404:
|
|
77
79
|
raise BadResponseError(
|
|
@@ -37,6 +37,7 @@ from outo_models_cli.errors import (
|
|
|
37
37
|
FileTooLargeError,
|
|
38
38
|
map_response_error,
|
|
39
39
|
)
|
|
40
|
+
from outo_models_cli.http import TIMEOUT_PUT
|
|
40
41
|
|
|
41
42
|
|
|
42
43
|
class _ProgressLike(Protocol):
|
|
@@ -88,7 +89,7 @@ def _put_stream(
|
|
|
88
89
|
progress.update(task_id, advance=len(chunk))
|
|
89
90
|
yield chunk
|
|
90
91
|
|
|
91
|
-
response = client.put(url, content=_chunk_iter(), headers=headers)
|
|
92
|
+
response = client.put(url, content=_chunk_iter(), headers=headers, timeout=TIMEOUT_PUT)
|
|
92
93
|
if response.status_code == 404:
|
|
93
94
|
raise BadResponseError("LFS object endpoint returned 404.")
|
|
94
95
|
if response.status_code == 401:
|
|
@@ -15,6 +15,7 @@ from outo_models_cli.api import (
|
|
|
15
15
|
unwrap,
|
|
16
16
|
)
|
|
17
17
|
from outo_models_cli.errors import BadResponseError, map_response_error
|
|
18
|
+
from outo_models_cli.http import TIMEOUT_COMMIT
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
def upload(
|
|
@@ -84,6 +85,7 @@ def upload(
|
|
|
84
85
|
f"/api/repos/{owner}/{name}/upload",
|
|
85
86
|
files=multipart_files,
|
|
86
87
|
data=fields,
|
|
88
|
+
timeout=TIMEOUT_COMMIT,
|
|
87
89
|
)
|
|
88
90
|
if response.status_code >= 400:
|
|
89
91
|
raise map_response_error(response)
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""Structured help text for every `omc` command and the root app.
|
|
2
|
+
|
|
3
|
+
Every block follows the same six-section layout so an AI reading the
|
|
4
|
+
help output can locate the bit it needs without scanning for prose:
|
|
5
|
+
|
|
6
|
+
PURPOSE one paragraph: what the command does, when to use it
|
|
7
|
+
USAGE exact invocation shape (positional args + flag list)
|
|
8
|
+
ARGUMENTS covered by Typer's auto-generated table; here we list
|
|
9
|
+
the env-var overrides that affect argument resolution
|
|
10
|
+
EXAMPLES 3-6 realistic invocations, each with a one-line note
|
|
11
|
+
EXIT CODES every exit value the command can produce and its meaning
|
|
12
|
+
NOTES auth requirements, config file location, server URL
|
|
13
|
+
resolution order, common error strings + fixes
|
|
14
|
+
|
|
15
|
+
The constants are plain strings (no `rich.console.Console` rendering),
|
|
16
|
+
so a non-TTY pipeline (`omc --help | grep EXAMPLES`) reads them cleanly.
|
|
17
|
+
`rich_markup_mode="rich"` is set on the root app, so the `[bold]` /
|
|
18
|
+
`[dim]` tags inside the constants are processed by Typer when the help
|
|
19
|
+
is rendered through a TTY and rendered verbatim otherwise.
|
|
20
|
+
|
|
21
|
+
Why a dedicated subpackage: the six-section layout must be CONSISTENT
|
|
22
|
+
across every command, and the markers are referenced both from the
|
|
23
|
+
command definitions (`epilog=...`) and from the test suite (asserted on
|
|
24
|
+
`omc <cmd> --help` output). Concentrating them in one import path
|
|
25
|
+
keeps the markers and the prose in lock-step so a one-place edit
|
|
26
|
+
cannot drift out of sync with the tests, while splitting the bodies
|
|
27
|
+
across per-command files keeps each module under the 250-LOC ceiling.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
from __future__ import annotations
|
|
31
|
+
|
|
32
|
+
from outo_models_cli.commands._help_text._auth import (
|
|
33
|
+
AUTH_APP_HELP,
|
|
34
|
+
AUTH_APP_MARKERS,
|
|
35
|
+
)
|
|
36
|
+
from outo_models_cli.commands._help_text._auth_cmds import (
|
|
37
|
+
AUTH_LOGIN_EPILOG,
|
|
38
|
+
AUTH_LOGIN_MARKERS,
|
|
39
|
+
AUTH_LOGOUT_EPILOG,
|
|
40
|
+
AUTH_LOGOUT_MARKERS,
|
|
41
|
+
AUTH_STATUS_EPILOG,
|
|
42
|
+
AUTH_STATUS_MARKERS,
|
|
43
|
+
AUTH_WHOAMI_EPILOG,
|
|
44
|
+
AUTH_WHOAMI_MARKERS,
|
|
45
|
+
)
|
|
46
|
+
from outo_models_cli.commands._help_text._common import (
|
|
47
|
+
COMMAND_INDEX_MARKER,
|
|
48
|
+
COMMON_EXIT_CODES,
|
|
49
|
+
CONCEPTS_MARKER,
|
|
50
|
+
CONFIG_MARKER,
|
|
51
|
+
CREDENTIAL_RESOLUTION_ORDER,
|
|
52
|
+
ENVIRONMENT_VARIABLES_MARKER,
|
|
53
|
+
EXAMPLES_MARKER,
|
|
54
|
+
EXIT_CODES_MARKER,
|
|
55
|
+
GETTING_STARTED_MARKER,
|
|
56
|
+
MORE_HELP_MARKER,
|
|
57
|
+
NOTES_MARKER,
|
|
58
|
+
PURPOSE_MARKER,
|
|
59
|
+
SERVER_RESOLUTION_ORDER,
|
|
60
|
+
USAGE_MARKER,
|
|
61
|
+
)
|
|
62
|
+
from outo_models_cli.commands._help_text._repo import (
|
|
63
|
+
REPO_APP_HELP,
|
|
64
|
+
REPO_APP_MARKERS,
|
|
65
|
+
REPO_CREATE_EPILOG,
|
|
66
|
+
REPO_DELETE_EPILOG,
|
|
67
|
+
REPO_LIST_EPILOG,
|
|
68
|
+
REPO_MARKERS,
|
|
69
|
+
)
|
|
70
|
+
from outo_models_cli.commands._help_text._root import ROOT_HELP, ROOT_MARKERS
|
|
71
|
+
from outo_models_cli.commands._help_text._transfer import (
|
|
72
|
+
DOWNLOAD_EPILOG,
|
|
73
|
+
LS_EPILOG,
|
|
74
|
+
TRANSFER_MARKERS,
|
|
75
|
+
UPLOAD_EPILOG,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# Required markers per command - the test suite asserts on each entry.
|
|
79
|
+
COMMAND_MARKERS: dict[str, tuple[str, ...]] = {
|
|
80
|
+
"auth login": AUTH_LOGIN_MARKERS,
|
|
81
|
+
"auth logout": AUTH_LOGOUT_MARKERS,
|
|
82
|
+
"auth whoami": AUTH_WHOAMI_MARKERS,
|
|
83
|
+
"auth status": AUTH_STATUS_MARKERS,
|
|
84
|
+
"repo create": REPO_MARKERS,
|
|
85
|
+
"repo delete": REPO_MARKERS,
|
|
86
|
+
"repo list": REPO_MARKERS,
|
|
87
|
+
"ls": TRANSFER_MARKERS,
|
|
88
|
+
"download": TRANSFER_MARKERS,
|
|
89
|
+
"upload": TRANSFER_MARKERS,
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
# Auth-app and repo-app markers (the `omc auth --help` / `omc repo --help`
|
|
93
|
+
# intermediate screens).
|
|
94
|
+
APP_MARKERS: dict[str, tuple[str, ...]] = {
|
|
95
|
+
"auth": AUTH_APP_MARKERS,
|
|
96
|
+
"repo": REPO_APP_MARKERS,
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
__all__ = [
|
|
101
|
+
"APP_MARKERS",
|
|
102
|
+
"AUTH_APP_HELP",
|
|
103
|
+
"AUTH_LOGIN_EPILOG",
|
|
104
|
+
"AUTH_LOGOUT_EPILOG",
|
|
105
|
+
"AUTH_STATUS_EPILOG",
|
|
106
|
+
"AUTH_WHOAMI_EPILOG",
|
|
107
|
+
"COMMAND_INDEX_MARKER",
|
|
108
|
+
"COMMAND_MARKERS",
|
|
109
|
+
"COMMON_EXIT_CODES",
|
|
110
|
+
"CONCEPTS_MARKER",
|
|
111
|
+
"CONFIG_MARKER",
|
|
112
|
+
"CREDENTIAL_RESOLUTION_ORDER",
|
|
113
|
+
"DOWNLOAD_EPILOG",
|
|
114
|
+
"ENVIRONMENT_VARIABLES_MARKER",
|
|
115
|
+
"EXAMPLES_MARKER",
|
|
116
|
+
"EXIT_CODES_MARKER",
|
|
117
|
+
"GETTING_STARTED_MARKER",
|
|
118
|
+
"LS_EPILOG",
|
|
119
|
+
"MORE_HELP_MARKER",
|
|
120
|
+
"NOTES_MARKER",
|
|
121
|
+
"PURPOSE_MARKER",
|
|
122
|
+
"REPO_APP_HELP",
|
|
123
|
+
"REPO_CREATE_EPILOG",
|
|
124
|
+
"REPO_DELETE_EPILOG",
|
|
125
|
+
"REPO_LIST_EPILOG",
|
|
126
|
+
"ROOT_HELP",
|
|
127
|
+
"ROOT_MARKERS",
|
|
128
|
+
"SERVER_RESOLUTION_ORDER",
|
|
129
|
+
"TRANSFER_MARKERS",
|
|
130
|
+
"UPLOAD_EPILOG",
|
|
131
|
+
"USAGE_MARKER",
|
|
132
|
+
]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Help text for the `omc auth` sub-Typer itself (the intermediate screen).
|
|
2
|
+
|
|
3
|
+
The four subcommands' help lives in `_auth_cmds.py`; this module only
|
|
4
|
+
owns the body shown by `omc auth --help` (the parent Typer's help) and
|
|
5
|
+
the marker tuple the test suite uses to lock that body.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from outo_models_cli.commands._help_text._common import (
|
|
11
|
+
PURPOSE_MARKER,
|
|
12
|
+
USAGE_MARKER,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
AUTH_SUBCOMMAND_INDEX: str = (
|
|
16
|
+
"AUTH SUBCOMMANDS\n"
|
|
17
|
+
" login Verify a PAT against the server and store it for `--server`.\n"
|
|
18
|
+
" logout Remove the stored credential for one server.\n"
|
|
19
|
+
" whoami Print the authenticated user, server, role, and token source.\n"
|
|
20
|
+
" status List every configured server and mark the default."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
AUTH_APP_HELP: str = "\n\n".join(
|
|
24
|
+
[
|
|
25
|
+
"PURPOSE\n"
|
|
26
|
+
" Manage stored credentials: log in, log out, verify, inspect.\n"
|
|
27
|
+
" All four subcommands share the same server-resolution rules.",
|
|
28
|
+
"USAGE\n omc auth [SUBCOMMAND] [OPTIONS]",
|
|
29
|
+
AUTH_SUBCOMMAND_INDEX,
|
|
30
|
+
"Run `omc auth <subcommand> --help` for the full PURPOSE / EXAMPLES /\n"
|
|
31
|
+
"EXIT CODES / NOTES reference of any individual subcommand.",
|
|
32
|
+
],
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
AUTH_APP_MARKERS: tuple[str, ...] = (PURPOSE_MARKER, USAGE_MARKER)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
__all__ = ["AUTH_APP_HELP", "AUTH_APP_MARKERS", "AUTH_SUBCOMMAND_INDEX"]
|