Skip to content
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

tqdm.std: add update_to #1540

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

tqdm.std: add update_to #1540

wants to merge 1 commit into from

Conversation

skshetry
Copy link

@skshetry skshetry commented Dec 25, 2023

Porting from dvc's Tqdm progress bar implementation.

https://github.com/iterative/dvc/blob/cf8195c829aa67425b87e4145bd33cae8584ee1e/dvc/progress.py#L114-L117

So, the implementation uses self.update() so that it refreshes based on self.update() logic. Also, adds a way to update total.

This function is pretty convenient and useful even outside dvc. Take an example of fsspec's callback that uses both total (aka self.size) and value (aka self.value) (i.e. current position) at once.

https://github.com/fsspec/filesystem_spec/blob/0ffe06cb767456b7c13904b57ec1c3ca60d53eae/fsspec/callbacks.py#L228

I see that there are mentions of update_to in docs and examples, which will likely have to change as a result of this PR. Also, I'm happy to rename this to something else (eg: set_position etc.).

See https://github.com/search?q=repo%3Atqdm%2Ftqdm+%22def+update_to%22&type=code.

Related: #1264.

Porting from dvc's Tqdm progress bar implementation.

https://github.com/iterative/dvc/blob/cf8195c829aa67425b87e4145bd33cae8584ee1e/dvc/progress.py#L114-L117

So, the implementation uses `self.update()` so that it refreshes based on `self.update()` logic.
Also, adds a way to update `total`.

This function is pretty convenient and useful even outside dvc. Take an example of fsspec's callback
that uses both `total` and `value` (i.e. current position) at once.

https://github.com/fsspec/filesystem_spec/blob/0ffe06cb767456b7c13904b57ec1c3ca60d53eae/fsspec/callbacks.py#L228

I see that there are mentions of `update_to` in docs and examples, which will likely have to change
as a result of this PR. So I'm happy to rename this to something else (eg: `set_position` etc.).

Related: tqdm#1264.
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.

None yet

1 participant