-
Notifications
You must be signed in to change notification settings - Fork 9
Suppress zenodo_get progress bar in CI environments #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suppress zenodo_get progress bar in CI environments #68
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
larsvilhuber
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good.
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.