Animate dataset name+version during load/publish#556
Open
Conversation
Contributor
Reviewer's GuideIntroduces a reusable ANSI-based Sequence diagram for shimmer animation integrated into audb.load with tqdmsequenceDiagram
actor User
participant Audb as audb
participant Load as load
participant Shimmer as Shimmer
participant Backend as backend_interface
participant Tqdm as tqdm
participant Stdout as stdout
participant Stderr as stderr
User->>Audb: load(name, version, verbose=True)
Audb->>Load: load(name, version, verbose=True)
Note over Load: Setup cache paths
Load->>Shimmer: new Shimmer("Get: ", "name vversion")
Load->>Shimmer: start()
Shimmer->>Stdout: print initial line and newline
Shimmer->>Stdout: install stdout.write hook
Shimmer->>Stderr: install stderr.write hook
activate Shimmer
Shimmer-->>Shimmer: background _animate() loop
loop Dependency resolution and locking
Load->>Load: dependencies(...)
Load->>Backend: load_header_to(...)
end
loop Download with progress bars
Backend->>Tqdm: update progress
Tqdm->>Stderr: "\r...progress bar..."
Stderr->>Shimmer: stderr_write_hook("\r...")
Shimmer-->>Shimmer: set _paused = True
Shimmer-->>Stdout: write plain text frame when first paused
end
Tqdm->>Stderr: "\r ...clear...\r" or "\n"
Stderr->>Shimmer: stderr_write_hook(clear or newline)
Shimmer-->>Shimmer: set _paused = False
Shimmer-->>Stdout: resume shimmering frames
Load-->>Audb: return db
Audb-->>User: db
Load->>Shimmer: stop()
Shimmer-->>Shimmer: set stop event, join thread
Shimmer->>Stdout: restore original write
Shimmer->>Stderr: restore original write
Shimmer->>Stdout: write final static line
deactivate Shimmer
Class diagram for the new Shimmer animation utilityclassDiagram
class Shimmer {
-str _prefix
-str _text
-str _suffix
-float _interval
-int _width
-Event _stop_event
-Thread _thread
-int _lines_below
-bool _paused
-Lock _lock
-callable _original_stdout_write
-callable _original_stderr_write
+__init__(prefix, text, suffix, interval, width)
+start()
+stop()
+_stdout_write_hook(s)
+_stderr_write_hook(s)
+_write_frame(rendered_text)
+_render_frame(center)
+_animate()
+__enter__()
+__exit__(exc_type, exc_val, exc_tb)
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
2577c8c to
ecb2a7d
Compare
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.
Closes #553
Alternative to #554
Adds a "shimmer" animation (bold text sweeping across the database name) to
load(),load_attachment(),load_media(),load_table(),load_to(), andpublish(). The animationruns in a background thread, pauses when
tqdmprogress bars are active, and resumes in between. A newaudb/core/shimmer.pymodule implements the animation via ANSI escape codes and stream proxying.Example video (the animation will reappear between progress bars, not shown in this video as we cancel during the first progress bar):
Screencast.from.07.04.2026.13.33.55.webm
Code for video
For
audb.load_to()andaudb.publish()we also add the following print statements to allow for the animation (before nothing was shown):As we now have an animation directly at the start, I removed showing a progress bar for downloading
db.parquetas it downloads in reasonable time and most users do not know whatdb.parquetis.An alternative implementation would be to always show the animation, also when progress bars are active:
Screencast.from.07.04.2026.13.36.20.webm