Repository navigation
Conversation
search --export, image upload <dir>, model upload and version download call SDK methods that print progress and status lines to stdout, so stdout was a mix of plain text and the JSON result. In --json mode these calls now run with stdout redirected to stderr, where the progress stays visible. model upload also silences the "loading Roboflow workspace..." message during workspace init, like the other handlers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Summary
Fixes #546.
roboflow/cli/_output.py: new context managersdk_output_to_stderr(args). With--jsonit redirects stdout to stderr; without--jsonit does nothing.search --export,image upload <dir>,model uploadandversion downloadrun their SDK call inside it, so the SDK's progress and status lines move to stderr and stdout carries only the JSON result.model uploadnow wraps the workspace init insuppress_sdk_output()like the other handlers, which drops "loading Roboflow workspace..." from its output.--json) is unchanged.Why stderr and not
suppress_sdk_output(): forimage upload <dir>, the per-image[ERR]lines are currently the only failure signal (#545), so they should stay visible. In JSON mode, stderr already carries the tqdm progress bars.Test plan
tests/cli/test_json_stdout.py: one test per handler with an SDK mock that prints, asserting that stdout parses withjson.loadsand that the printed line ends up on stderr, plus one test that text mode keeps SDK output on stdout. The four handler tests fail onmainand pass with this change.responsesand the commands run throughtyper.testing.CliRunner: all four commands now print only the JSON document on stdout.make check_code_qualitypasses;python -m unittestruns 1214 tests, OK (1 skipped).