From dfb09aba4151157737178d3d7df76cf082f4f086 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:13:02 +0000 Subject: [PATCH 1/6] Initial plan From 45947d49ffb90f72b233112cb4d5166d040e9d46 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:18:36 +0000 Subject: [PATCH 2/6] Disable zenodo_get progress bar in CI environment Co-authored-by: larsvilhuber <7022712+larsvilhuber@users.noreply.github.com> --- tools/download_zenodo_public.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tools/download_zenodo_public.sh b/tools/download_zenodo_public.sh index 191d222..dcec2d2 100755 --- a/tools/download_zenodo_public.sh +++ b/tools/download_zenodo_public.sh @@ -201,7 +201,31 @@ then fi echo "Downloading Zenodo record $projectID to $zenodo_dir..." -$python -m zenodo_get --output-dir=$zenodo_dir $projectID + +# Check if running in CI environment and disable progress bar if so +if [ -n "$CI" ]; then + # In CI environment, suppress the progress bar by monkey-patching wget + $python -c " +import sys +import os +os.environ['CI'] = '1' # Ensure CI is set for the module + +# Monkey-patch wget to disable progress bar in CI +import wget +_original_download = wget.download +def _download_no_bar(url, out=None, bar=None): + return _original_download(url, out, bar=None) +wget.download = _download_no_bar + +# Now run zenodo_get with the patched wget +from zenodo_get import zget +sys.argv = ['zenodo_get', '--output-dir=$zenodo_dir', '$projectID'] +zget.cli() +" +else + # Normal mode with progress bar + $python -m zenodo_get --output-dir=$zenodo_dir $projectID +fi if [ $? -eq 0 ]; then echo "Download completed successfully!" From 1d4786a41f187f613d362c4c2196c804d7af4fbf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:20:33 +0000 Subject: [PATCH 3/6] Fix shell variable expansion in CI Python script Co-authored-by: larsvilhuber <7022712+larsvilhuber@users.noreply.github.com> --- tools/download_zenodo_public.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/download_zenodo_public.sh b/tools/download_zenodo_public.sh index dcec2d2..4115f79 100755 --- a/tools/download_zenodo_public.sh +++ b/tools/download_zenodo_public.sh @@ -205,10 +205,9 @@ echo "Downloading Zenodo record $projectID to $zenodo_dir..." # Check if running in CI environment and disable progress bar if so if [ -n "$CI" ]; then # In CI environment, suppress the progress bar by monkey-patching wget - $python -c " + # Pass shell variables as command-line arguments to Python + $python << PYTHON_SCRIPT import sys -import os -os.environ['CI'] = '1' # Ensure CI is set for the module # Monkey-patch wget to disable progress bar in CI import wget @@ -221,7 +220,7 @@ wget.download = _download_no_bar from zenodo_get import zget sys.argv = ['zenodo_get', '--output-dir=$zenodo_dir', '$projectID'] zget.cli() -" +PYTHON_SCRIPT else # Normal mode with progress bar $python -m zenodo_get --output-dir=$zenodo_dir $projectID From 6ccff4f55422a9deb2961b01857fb626c9bb3fe8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:23:09 +0000 Subject: [PATCH 4/6] Add documentation explaining monkey-patch approach Co-authored-by: larsvilhuber <7022712+larsvilhuber@users.noreply.github.com> --- tools/download_zenodo_public.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/download_zenodo_public.sh b/tools/download_zenodo_public.sh index 4115f79..a5bdb52 100755 --- a/tools/download_zenodo_public.sh +++ b/tools/download_zenodo_public.sh @@ -205,7 +205,9 @@ echo "Downloading Zenodo record $projectID to $zenodo_dir..." # Check if running in CI environment and disable progress bar if so if [ -n "$CI" ]; then # In CI environment, suppress the progress bar by monkey-patching wget - # Pass shell variables as command-line arguments to Python + # Note: zenodo_get uses the wget library which doesn't respect environment + # variables for disabling progress bars. The only way to disable it is to + # monkey-patch the wget.download() function to pass bar=None. $python << PYTHON_SCRIPT import sys From a2c553100652ac788372ff103c4c919b81506492 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:28:13 +0000 Subject: [PATCH 5/6] Simplify CI progress bar suppression using stdout redirect Co-authored-by: larsvilhuber <7022712+larsvilhuber@users.noreply.github.com> --- tools/download_zenodo_public.sh | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/tools/download_zenodo_public.sh b/tools/download_zenodo_public.sh index a5bdb52..d4dce5d 100755 --- a/tools/download_zenodo_public.sh +++ b/tools/download_zenodo_public.sh @@ -202,29 +202,11 @@ fi echo "Downloading Zenodo record $projectID to $zenodo_dir..." -# Check if running in CI environment and disable progress bar if so +# In CI environments, redirect stdout to suppress the progress bar +# (zenodo_get writes informational messages to stderr, progress bar to stdout) if [ -n "$CI" ]; then - # In CI environment, suppress the progress bar by monkey-patching wget - # Note: zenodo_get uses the wget library which doesn't respect environment - # variables for disabling progress bars. The only way to disable it is to - # monkey-patch the wget.download() function to pass bar=None. - $python << PYTHON_SCRIPT -import sys - -# Monkey-patch wget to disable progress bar in CI -import wget -_original_download = wget.download -def _download_no_bar(url, out=None, bar=None): - return _original_download(url, out, bar=None) -wget.download = _download_no_bar - -# Now run zenodo_get with the patched wget -from zenodo_get import zget -sys.argv = ['zenodo_get', '--output-dir=$zenodo_dir', '$projectID'] -zget.cli() -PYTHON_SCRIPT + $python -m zenodo_get --output-dir=$zenodo_dir $projectID > /dev/null else - # Normal mode with progress bar $python -m zenodo_get --output-dir=$zenodo_dir $projectID fi From 59aed9fa64a70ec8a71161e360c7a852387300a2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:33:19 +0000 Subject: [PATCH 6/6] Create zenodo_get_ci.py wrapper script for CI-friendly downloads Co-authored-by: larsvilhuber <7022712+larsvilhuber@users.noreply.github.com> --- tools/download_zenodo_public.sh | 9 ++---- tools/zenodo_get_ci.py | 55 +++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 7 deletions(-) create mode 100755 tools/zenodo_get_ci.py diff --git a/tools/download_zenodo_public.sh b/tools/download_zenodo_public.sh index d4dce5d..455edec 100755 --- a/tools/download_zenodo_public.sh +++ b/tools/download_zenodo_public.sh @@ -202,13 +202,8 @@ fi echo "Downloading Zenodo record $projectID to $zenodo_dir..." -# In CI environments, redirect stdout to suppress the progress bar -# (zenodo_get writes informational messages to stderr, progress bar to stdout) -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 +# Use zenodo_get_ci.py wrapper which handles CI detection and progress bar suppression +$python tools/zenodo_get_ci.py --output-dir=$zenodo_dir $projectID if [ $? -eq 0 ]; then echo "Download completed successfully!" diff --git a/tools/zenodo_get_ci.py b/tools/zenodo_get_ci.py new file mode 100755 index 0000000..371d381 --- /dev/null +++ b/tools/zenodo_get_ci.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +""" +Wrapper for zenodo_get that suppresses progress bar in CI environments. + +This script wraps the zenodo_get module to provide a CI-friendly interface +that suppresses the animated progress bar while preserving all informational +messages. It detects CI environments via the CI environment variable. + +Usage: + python3 tools/zenodo_get_ci.py [ZENODO_GET_OPTIONS] + +Examples: + # Download all files from a Zenodo record + python3 tools/zenodo_get_ci.py --output-dir=zenodo-123456 123456 + + # Use sandbox + python3 tools/zenodo_get_ci.py --sandbox --output-dir=zenodo-123456 123456 + +Environment Variables: + CI - When set, suppresses the progress bar by redirecting stdout to /dev/null + +Behavior: + - In CI environments (CI env var set): Progress bar is suppressed + - In interactive environments: Progress bar is shown normally + - All informational messages are preserved (they go to stderr) + +Note: + The zenodo_get module writes informational messages to stderr via eprint(), + while the progress bar from the wget library writes to stdout. This allows + us to suppress only the progress bar by redirecting stdout. +""" + +import os +import sys + +# Import zenodo_get first +from zenodo_get import zget + +if __name__ == '__main__': + # Suppress progress bar in CI by redirecting stdout to /dev/null + if os.getenv("CI"): + # Save original stdout + original_stdout = sys.stdout + # Redirect stdout to /dev/null to suppress progress bar + sys.stdout = open(os.devnull, 'w') + + try: + zget.cli() + finally: + # Restore stdout + sys.stdout.close() + sys.stdout = original_stdout + else: + # Normal mode - show progress bar + zget.cli()