`--json` output is not valid JSON for `search --export`, `image upload <dir>`, `model upload` and `version download`
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
Start with search.py::_do_export, image.py::_handle_upload_directory, model.py::_upload_model, and version.py::_download, then read CLI-COMMANDS.md and CLAUDE.md for the JSON-output contract and SDK-output guidance. The issue says the reporter is sending a PR right away, so check for that work before starting; done means each command's stdout parses with json.loads while progress and failure messages remain visible.
索引モデルが issue の本文から書いたものです。
説明
CLI-COMMANDS.md describes --json as "Structured JSON output (for agents and piping)", and CLAUDE.md asks handlers to wrap SDK calls in suppress_sdk_output(). Four handlers call SDK methods that print to stdout outside such a block, so stdout is a mix of plain-text status lines and the pretty-printed JSON result, and json.loads(stdout) or | jq fails (roboflow 1.7.0 and current main; --quiet does not change it):
| Command | Handler → SDK call | Printed to stdout before the JSON |
|---|---|---|
search --export |
search.py::_do_export → Workspace.search_export() |
"Export started (id=...)...", "If this takes too long, ...", "Search export extracted to ..." |
image upload <dir> |
image.py::_handle_upload_directory → Workspace.upload_dataset() |
"Uploading to existing project ...", one [UPLOADED]/[DUPLICATE]/[ERR] line per image |
model upload |
model.py::_upload_model → Roboflow.workspace(), Workspace.project(), Version.deploy() / Workspace.deploy_model() |
"loading Roboflow workspace...", "loading Roboflow project..." (this handler does not use suppress_sdk_output() at all), "View the status of your deployment at: ...", "Share your model with the world at: ..." (or the error) |
version download |
version.py::_download → Version.download() |
when the format is generated on demand: "\rExporting format coco in progress : 40.0%", "\rVersion export complete for coco format" |
Example (offline: HTTP mocked with responses, command run with typer.testing.CliRunner):
$ roboflow --json search "project:my-project" --export -l out
Export started (id=exp1). Polling for completion...
If this takes too long, you can check the export status at: https://api.roboflow.com/my-workspace/search/export/exp1?api_key=YOUR_API_KEY
Search export extracted to /.../out
{
"status": "completed",
"path": "/.../out"
}
Proposal: in JSON mode, run these SDK calls inside contextlib.redirect_stdout(sys.stderr), so progress stays visible and stdout stays JSON, with one test per handler that parses stdout with json.loads. Simply suppressing the output with suppress_sdk_output() would hide the per-image [ERR] lines of image upload, which are currently its only failure signal (#545). A more general alternative: in JSON mode, redirect sys.stdout to stderr for the whole command and let output() write to the original stdout, which would also cover future handlers.
I'm sending a PR for the per-handler variant right away.
cc @yeldarby
- 主要言語
- Python
- スター
- 633
- フォーク
- 141
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 14
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
roboflow/roboflow-python のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
roboflow/roboflow-python#545 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
roboflow/roboflow-python#505 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
roboflow/roboflow-python#433 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
roboflow/roboflow-python#429 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
roboflow/roboflow-python#427 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
roboflow/roboflow-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
aicell-lab/bioengine#232 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
modelscope/evalscope#1836 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
jbaruch/speaker-toolkit#480 ·
メンテナーはふだん 1 日以内に返信