Repository navigation
fix(cli): keep stdout valid JSON under --json (#546) - #553
Closed
tonylampada wants to merge 3 commits into
Closed
tonylampada wants to merge 3 commits into
tonylampada wants to merge 3 commits into
Conversation
…ds (#546) search --export, image upload <dir>, model upload and version download ran SDK calls that print status lines to stdout, so --json output was not parseable. In --json mode those calls now run with stdout redirected to stderr (progress and per-image [ERR] lines stay visible); text mode is unchanged. model upload also silences workspace/project init like the other handlers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Newer ruff (unpinned in CI) flags these two imports, failing check_code_quality. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Deliver checks (SLM-101)
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Review round (jarbas-review), one pass:
|
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #546. Agents piping
roboflow --jsonintojqbreak onsearch --export,image upload <dir>,model uploadandversion download, because SDK status lines land on stdout before the JSON. Under--jsonthese SDK calls now print to stderr, so stdout is only the JSON document; text mode is unchanged. Serves objective O8 — one canonical API shape on every surface (CLI).Note: #547 (external) takes the same approach; this one adds HTTP-level tests with
responses. Merge whichever the maintainers prefer.What changed
sdk_output_to_stderr(args)in_output.py: redirects stdout→stderr only under--json.suppress_sdk_output(), so per-image[ERR]lines (Failed uploads are reported as success: Version.deploy() / Workspace.deploy_model() don't raise, and roboflow model upload / roboflow image upload <dir> exit 0 #545) stay visible.model uploadnow silences workspace/project init like the other handlers.datetime→dtalias in 2 files; the latest (unpinned) ruff flags ICN001 and fails CI on every PR.How has this change been tested?
tests/cli/test_json_stdout.py, one per command, HTTP mocked withresponses,json.loads(stdout); plus a text-mode regression test. The 4--jsontests fail on main.Any specific deployment considerations
None.
Next step
Done for #546; a general "redirect stdout for the whole command under
--json" would cover future handlers (deliberately out of scope).🤖 Generated with Claude Code