-
Notifications
You must be signed in to change notification settings - Fork 74
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
feature: add support for non-tqdm arbitrary progress bars for HTTPDownloader #228
feature: add support for non-tqdm arbitrary progress bars for HTTPDownloader #228
Conversation
💖 Thanks for opening your first pull request! 💖 Please make sure you read the following:
A few things to keep in mind:
|
7291308
to
f22484f
Compare
2825da0
to
d36a13a
Compare
Apparently there's exactly one line I'm not hitting but I can't figure out which one and I can't access the codecov report for some reason. |
d36a13a
to
d7c1622
Compare
d7c1622
to
40fcc89
Compare
40fcc89
to
39851b7
Compare
👋🏽 Hi @neutrinoceros thanks for the PR! This looks nice a great addition. I'm a bit strapped for time at the moment so this may take a little while to be merged. I hope that's OK. A few quick questions:
|
Thanks for getting back to me ! The specs are designed around tqdm's api to allow more flexibility in pooch with minimal change. Basically I'm going with a duck typing approach : if it looks, feels and tastes like a tqdm pbar, we can treat it as if it was, transparently and without creating much technical debt on your side. Other libraries use slightly different method names as far as I can tell (The ones I have personally studied are tqdm and rich.progress), but it's only a matter of wrapping them with a little syntactic sugar to make them compatible. |
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.
Great stuff @neutrinoceros (and awesome handle)! Left a few suggestions, mostly for the docs. Otherwise, this seems to work like a charm 👍🏽
doc/intermediate.rst
Outdated
self.count = 0 | ||
|
||
def close(self): | ||
print("", file=sys.stderr) |
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.
Could you add an example using this class with HTTPDownloader
?
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.
Might also be good to add a .. note:
here saying that this only available for HTTPDownloader
for now.
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.
done !
Thanks for your careful review ! I'll go back to this in a few days. |
Co-authored-by: Leonardo Uieda <leouieda@gmail.com>
🎉🎉🎉 Congrats on merging your first pull request and welcome to the team! 🎉🎉🎉 If you would like to be added as a author on the Zenodo archive of the next release, make sure that you have added your full name, affiliation, and ORCID (optional) to the We hope that this was a good experience for you. Let us know if there is any way that the contributing process could be improved. |
@neutrinoceros thank you for the contribution! I made a few minor edits to the docs but this is looking really good. |
Glad you like it ! Thank you for your support in getting this to the finish line. Do you intend to release it in the same go or should I except a delay ? I'm good with either way :) |
I'm just going to push some updates to the docs and then make a release. It should be out within the next few weeks. |
Hi ! here's a patch with minimal changes required to make the downloaders accept an arbitrary "progress bar" object from outside of pooch, making tqdm not the only way to display progress. In particular, this allows users to create custom progress bars with
rich
. The reason I'm doing this is that there are a lot of places in the project I maintain use progress bars (and the pooch downloader is one of them), and I want them to have a visual consistency.I'm opening as a draft for now because I need to work a little more to figure out a proper way to expose the
total
computation, since it would be useful to properly define a progress from outside pooch.I may need help to write tests (or update the existing ones) for this, but I tested it for HTTPDownloader on the project I'm maintaining (https://github.com/yt-project/yt).
Here's a screenshot of it in action
I'll try to come up with a simple example of arbitrary progress bar class to contribute to docs later.
Reminders:
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
and the base__init__.py
file for the package.AUTHORS.md
file (if you haven't already) in case you'd like to be listed as an author on the Zenodo archive of the next release.