Skip to content

Add a progress callback to GoogleDriveFile.Upload() #54

Open

Description

@KengoSawa2

Hello

Thank you for development and contributions of PyDrive2:)

I want to upload a huge zip file by PyDrive2.
When I looked into the API, GetContents() has a callback for progress.
But UpLoad() does not.

https://gsuitedevs.github.io/PyDrive/docs/build/html/pydrive.html#pydrive.files.GoogleDriveFile.Upload

Are you planning to add a callback to show the upload progress?
Progress is a very important feature as I plan to upload a zip close to 750GB of single file

Related:
#49 (comment)

Activity

  1. changed the title [-]Hope for additional features: Upload progress callback[/-] [+]upload: add callback[/+] on Sep 15, 2020
  2. efiop commented on Sep 15, 2020

    @efiop
    Contributor

    Hi @KengoSawa2 !

    Take a look at https://github.com/iterative/dvc/blob/5e69e29b2f0e3df9b9eab5d682988fd01121b015/dvc/tree/gdrive.py#L362 , where we wrap the fobj we are uploading into a tqdm progress bar.

    Indeed, it would be great to have an explicit callback argument to handle that, but we don't currently have plans to introduce it ourselves. That being said, we would be happy to accept/help out if anyone is willing to contribute such a feature.

  3. added
    enhancement
    and removed
    enhancement
    on Sep 15, 2020
  4. TheManchineel commented on Jun 16, 2022

    @TheManchineel

    Hi @KengoSawa2 !

    Take a look at https://github.com/iterative/dvc/blob/5e69e29b2f0e3df9b9eab5d682988fd01121b015/dvc/tree/gdrive.py#L362 , where we wrap the fobj we are uploading into a tqdm progress bar.

    Indeed, it would be great to have an explicit callback argument to handle that, but we don't currently have plans to introduce it ourselves. That being said, we would be happy to accept/help out if anyone is willing to contribute such a feature.

    So if I understand correctly, what's happening here is that you're tracking what parts of the file have been read by PyDrive?

  5. changed the title [-]upload: add callback[/-] [+]Add a progress callback to GoogleDriveFile.Upload()[/+] on Nov 28, 2026
  6. shcheklein commented on Nov 28, 2026

    @shcheklein
    Member

    Yes, the wrapper counts bytes read from the local stream. That is useful progress feedback, but it cannot tell you how many bytes Drive has acknowledged, and a retry can read the same bytes again.

    With the filesystem interface, put_file already accepts an fsspec callback in 1.21.3 and on main. For example, with an authenticated filesystem mounted at folder_id:

    from fsspec.callbacks import TqdmCallback
    
    with TqdmCallback(tqdm_kwargs={"unit": "B", "unit_scale": True}) as progress:
        fs.put_file("archive.zip", f"{folder_id}/archive.zip", callback=progress)

    Keeping this open for a progress callback on GoogleDriveFile.Upload() itself. Filesystem upload implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions