-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add an optional attribute to handle updates during atlas downloads #126
Conversation
Atlas download progress is currently handled within a Rich progress indicator, but external libraries do not have access to these updates. Add an optional attribute to `BrainGlobeAtlas` to reference a handler that is updated during atlas downloads. This handler is a function that takes the currently competed and total required bytes to download the given atlas.
Provide real-time updates by supplying a handler to BrainGlobe, which requires brainglobe/brainglobe-atlasapi#126. Format download sizes in human-readable units for the progress bar message.
- Remove whitespace on empty line - Format line width, indentation, and closing parenthesis placement
Attempted to fix formatting errors from the lint action by running the |
Looks good to me @yoda-vid. Just because everything else depends on this package, I'll wait for @vigji or @FedeClaudi to approve before merging. |
Sounds good, thanks @adamltyson! Open to any feedback to make this best fit with BrainGlobe's goals. |
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.
Sorry for taking so long! Good to go for me.
Merged, thanks @yoda-vid! |
Description
What is this PR
Atlas download progress is currently handled within a Rich progress indicator, but external libraries do not have access to these updates. This PR adds an optional attribute to
BrainGlobeAtlas
to reference a handler that is updated during atlas downloads. This handler can be given as a function that takes the currently competed and total required bytes to download the given atlas.Why is this PR needed?
Provides access to track real-time atlas download updates by external apps. There may be better ways to provide this functionality...I'm all ears to alternatives.
What does this PR do?
Adds a hook called by
bg-atlasapi
during atlas downloads.References
I am using this handler to update a progress bar in MagellanMapper when downloading atlases through BrainGlobe (see sanderslab/magellanmapper#75).
How has this PR been tested?
Is this a breaking change?
No
Does this PR require an update to the documentation?
Updated the docstrings with the changes. Also added a type hint to the handler to specify its expected parameters.
Checklist: