Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

The zenodo_get module 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:

  • New Python wrapper script for zenodo_get module
  • Detects $CI environment variable to determine execution context
  • Redirects stdout to /dev/null when in CI mode to suppress progress bar
  • Preserves all informational messages (written to stderr)
  • Passes all command-line arguments through to zenodo_get unchanged
  • Fully executable and reusable as a standalone tool

Modified tools/download_zenodo_public.sh:

  • Updated to call the new zenodo_get_ci.py wrapper script
  • Simplified implementation from conditional redirects to single command
  • Maintains same functionality with cleaner code

Implementation

The zenodo_get module has no command-line option to disable the progress bar. Since zenodo_get writes all informational messages to stderr (via eprint()) and only the progress bar goes to stdout, the wrapper script suppresses just the progress bar by redirecting stdout to /dev/null when running in CI:

if os.getenv("CI"):
    # Redirect stdout to suppress progress bar
    sys.stdout = open(os.devnull, 'w')
    try:
        zget.cli()
    finally:
        sys.stdout.close()
        sys.stdout = original_stdout
else:
    # Normal mode - show progress bar
    zget.cli()

The shell script simply calls the wrapper:

$python tools/zenodo_get_ci.py --output-dir=$zenodo_dir $projectID

This approach:

  • Suppresses only the progress bar output in CI
  • Preserves all informational messages (written to stderr)
  • Maintains full functionality in interactive mode
  • Provides a clean, maintainable, and reusable solution

This matches the existing pattern in download_zenodo_draft.py where the custom Spinner class already checks for $CI before starting animation threads.

Original prompt

This section details on the original issue you should resolve

<issue_title>Turn off the spinner for zenodo download when run in CI environment</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 19, 2026 14:18
Co-authored-by: larsvilhuber <7022712+larsvilhuber@users.noreply.github.com>
Co-authored-by: larsvilhuber <7022712+larsvilhuber@users.noreply.github.com>
Copy link
Member

@larsvilhuber larsvilhuber left a 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>
Copilot AI changed the title [WIP] Turn off spinner for Zenodo download in CI environment Suppress zenodo_get progress bar in CI environments Jan 19, 2026
Copilot AI requested a review from larsvilhuber January 19, 2026 14:24
Copy link
Member

@larsvilhuber larsvilhuber left a 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>
Copy link
Contributor Author

Copilot AI commented Jan 19, 2026

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.

You're absolutely right! I've simplified the implementation to use stdout redirection instead of monkey-patching.

Why not use a zenodo_get argument?
The zenodo_get CLI has no option to disable the progress bar (verified with --help).

Why stdout redirection works better:

  • zenodo_get writes all informational messages to stderr via eprint()
  • Only the progress bar (from the wget library) writes to stdout
  • Redirecting stdout to /dev/null in CI cleanly suppresses just the progress bar

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>
Copy link
Contributor Author

Copilot AI commented Jan 19, 2026

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 downloa...

Done! I've created tools/zenodo_get_ci.py as a dedicated Python wrapper script (commit 59aed9f).

The new implementation:

  • tools/zenodo_get_ci.py: Standalone Python script that wraps zenodo_get module

    • Detects CI via $CI environment variable
    • Suppresses progress bar by redirecting stdout to /dev/null in CI
    • Preserves all informational messages (written to stderr)
    • Passes all arguments through to zenodo_get unchanged
  • tools/download_zenodo_public.sh: Updated to simply call the wrapper

    $python tools/zenodo_get_ci.py --output-dir=$zenodo_dir $projectID

This is much cleaner than inline Python and follows the pattern of other Python tools in the repository.

Copy link
Member

@larsvilhuber larsvilhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good.

@larsvilhuber larsvilhuber marked this pull request as ready for review January 19, 2026 15:04
@larsvilhuber larsvilhuber merged commit d36a370 into development Jan 19, 2026
1 check passed
@larsvilhuber larsvilhuber deleted the copilot/turn-off-spinner-zenodo-download branch January 19, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Turn off the spinner for zenodo download when run in CI environment

2 participants