Suppress zenodo_get progress bar in CI environments#68
Suppress zenodo_get progress bar in CI environments#68larsvilhuber merged 6 commits intodevelopmentfrom
Conversation
Co-authored-by: larsvilhuber <7022712+larsvilhuber@users.noreply.github.com>
Co-authored-by: larsvilhuber <7022712+larsvilhuber@users.noreply.github.com>
larsvilhuber
left a comment
There was a problem hiding this comment.
This is a kludge. Explain why you cannot do this with an argument to zenodo_get. Alternatively, why you cannot do this by simply redirecting the spinner output to /dev/null.
Co-authored-by: larsvilhuber <7022712+larsvilhuber@users.noreply.github.com>
larsvilhuber
left a comment
There was a problem hiding this comment.
In-line Python is still a hack. Please write out a new Python script, stored in tools/, called zenodo_get_ci.py that implements what is here. Then simply call the modified Python script to download, using the same arguments.
Co-authored-by: larsvilhuber <7022712+larsvilhuber@users.noreply.github.com>
You're absolutely right! I've simplified the implementation to use stdout redirection instead of monkey-patching. Why not use a zenodo_get argument? Why stdout redirection works better:
The new implementation (commit a2c5531) is much simpler: if [ -n "$CI" ]; then
$python -m zenodo_get --output-dir=$zenodo_dir $projectID > /dev/null
else
$python -m zenodo_get --output-dir=$zenodo_dir $projectID
fi |
Co-authored-by: larsvilhuber <7022712+larsvilhuber@users.noreply.github.com>
Done! I've created The new implementation:
This is much cleaner than inline Python and follows the pattern of other Python tools in the repository. |
The
zenodo_getmodule displays an animated progress bar during downloads that clutters CI logs and causes unnecessary output noise in automated workflows.Changes
Created
tools/zenodo_get_ci.py:zenodo_getmodule$CIenvironment variable to determine execution context/dev/nullwhen in CI mode to suppress progress barModified
tools/download_zenodo_public.sh:zenodo_get_ci.pywrapper scriptImplementation
The
zenodo_getmodule has no command-line option to disable the progress bar. Sincezenodo_getwrites all informational messages to stderr (viaeprint()) and only the progress bar goes to stdout, the wrapper script suppresses just the progress bar by redirecting stdout to/dev/nullwhen running in CI:The shell script simply calls the wrapper:
This approach:
This matches the existing pattern in
download_zenodo_draft.pywhere the customSpinnerclass already checks for$CIbefore starting animation threads.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.