GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DISCUSSION: Switch to `apitools` as a dependency · Issue #755 · googleapis/google-cloud-python

DISCUSSION: Switch to apitools as a dependency #755

New issue
Copy link
New issue
Copy link
Closed
#811
Closed
DISCUSSION: Switch to apitools as a dependency#755
#811
Copy link
Assignees
dhermes
Labels
api: coreapi: storageIssues related to the Cloud Storage API.packaging

Description

@dhermes
dhermes
opened on Mar 24, 2015
Issue body actions

This was an issue before apitools was on PyPI and before it's dependencies were Py3 compatible. Now neither of these are blockers.

See #754 for context.

Activity

Next
  1. dhermes
    added
    api: storageIssues related to the Cloud Storage API.
    packaging
    api: core
    on Mar 24, 2015
  2. dhermes
    added this to the This milestone has been deleted milestone on Mar 24, 2015
  3. dhermes commented on Mar 24, 2015

    @dhermes
    dhermes
    on Mar 24, 2015
    ContributorAuthor
    More actions

    I've tentatively started to test how python3-ready the apitools codebase is and haven't had much luck.

    I couldn't even get tox to run: google/apitools#4

    In addition, it seems there are some Python 2 specific imports, for example the StringIO module is used.

  4. dhermes commented on Mar 31, 2015

    @dhermes
    dhermes
    on Mar 31, 2015
    ContributorAuthor
    More actions

    @craigcitro Can we chat about this?

  5. dhermes commented on Mar 31, 2015

    @dhermes
    dhermes
    on Mar 31, 2015
    ContributorAuthor
    More actions

    @craigcitro Can you provide a snippet or two for

    1. How to create and use a generated client
    2. Compatibility / dependency issues to worry about (e.g. Py3)
  6. craigcitro commented on Apr 4, 2015

    @craigcitro
    craigcitro
    on Apr 4, 2015
    Contributor
    More actions
    1. using apitools is two steps: first, create a client, and second, load that code, then instantiate and call.

    from scratch:

    (sample)[~/t/storage_example] $ pip install google-apitools[cli]
    ... <installing> ...
    (sample)[~/t/storage_example] $ gen_client --discovery_url=storage.v1 --nogenerate_cli --outdir=storage client
    (sample)[~/t/storage_example] $ l
    total 0
    0 storage/
    (sample)[~/t/storage_example] $ cd storage/
    (sample)[~/t/storage_example/storage] $ l
    total 120
      4 __init__.py              44 storage_v1_client.py     72 storage_v1_messages.py
    (sample)[~/t/storage_example/storage] $ python
    Python 2.7.9 (default, Jan  8 2015, 10:14:19)
    [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import apitools.base.py as apitools_base
    >>> import storage_v1_client as storage_client
    >>> import storage_v1_messages as storage_messages
    >>> client = storage_client.StorageV1()
    >>> client.buckets.List(storage_messages.StorageBucketsListRequest(project='google.com:apitools'))
    <Buckets
     items: [<Bucket
        ... copious output ...
     kind: u'storage#buckets'>
    >>> buckets = _
    >>> [bucket.name for bucket in buckets.items]
    ['apitools', ... <a zillion other buckets> ..., 'apitools-public']
    >>> import StringIO
    >>> upload = apitools_base.Upload.FromStream(StringIO.StringIO('hello world\n'), mime_type='text/plain')
    >>> request = storage_messages.StorageObjectsInsertRequest()
    >>> request.bucket = 'apitools'
    >>> request.name = 'test_object'
    >>> client.objects.Insert(request, upload=upload)
    <new object metadata comes back>
    >>> client.objects.Get(storage_messages.StorageObjectsGetRequest(bucket='apitools', object='test_object'), download=apitools_base.Download.FromFile('important.txt'))
    Received bytes 0-11/12
    Download complete
    >>>
    (sample)[~/t/storage_example/storage] $ cat important.txt
    hello world
    (sample)[~/t/storage_example/storage] $
    

    there's plenty more in there -- i'm happy to do a little demo, if there's interest.

    1. for compatibility, there are really three questions: generated clients, generated CLIs, and the gen_client tool itself. you should only care about the first, and eventually the third.

    the first should already work in py3, or if not, i want to fix it. generated CLIs are furthest out, because it involves changing the codegen to not use gflags/apputils, but i don't think you care right now. for gen_client, it's actually a quick fix (where i plan to clean up 1-2 other small things), but i'm short on time (cf the long response on this! 😏)

  7. dhermes commented on Apr 6, 2015

    @dhermes
    dhermes
    on Apr 6, 2015
    ContributorAuthor
    More actions

    @craigcitro I'll take you up on that demo.

    It seems the thorniest parts will be

    • auth
    • media/multipart/resumable uploads
    • batching
  8. craigcitro commented on Apr 6, 2015

    @craigcitro
    craigcitro
    on Apr 6, 2015
    Contributor
    More actions

    sure -- thursday would be best for me, but we can coordinate by email. some offhand answers:

    • for auth, you can either let apitools do it, or just pass a valid oauth2client.Credentials object as the credentials argument to the constructor, and it'll use those credentials.
    • multipart and resumable are both handled for you; we choose a default based on size, but you can change it on the Upload/Download instance as desired.
    • batching works fine (though, as discussed, not with media).
  9. dhermes commented on Apr 7, 2015

    @dhermes
    dhermes
    on Apr 7, 2015
    ContributorAuthor
    More actions

    @craigcitro RE: "(though, as discussed, not with media)." When did we discuss? Link? Media here means any files (i.e. non-metadata) at all or "media uploads"? Is it just a missing feature of the library or not supported by the backend?

  10. craigcitro commented on Apr 7, 2015

    @craigcitro
    craigcitro
    on Apr 7, 2015
    Contributor
    More actions

    @dhermes #654 (comment)

    media means anything involving upload/download of files. apitools doesn't support it (and throws an appropriate error, i believe), but there's no support on the backend.

  11. dhermes commented on Apr 7, 2015

    @dhermes
    dhermes
    on Apr 7, 2015
    ContributorAuthor
    More actions

    Thanks for the reference! It totally slipped my mind.

  12. dhermes commented on Apr 8, 2015

    @dhermes
    dhermes
    on Apr 8, 2015
    ContributorAuthor
    More actions

    Two quick notes:

    • The import import apitools.base.py as apitools_base is not instantaneous. Is there a way to disable whatever magic occurs?
    • client = storage_client.StorageV1() tries to get implicit credentials. Is
    client = storage_client.StorageV1(credentials=FOO, get_credentials=False)

    sufficient to dodge this overhead?


    Overarching theme here: what implicit magic do I need to worry about to turn off?


    Secondary to all this, is I noticed a big fat

    Generating new OAuth credentials ...
    WARNING:root:This function, oauth2client.tools.run(), and the use of the gflags library are deprecated and will be removed in a future version of the library.
    Go to the following link in your browser:
    

    Is there a corresponding bug in the repo?

  13. dhermes commented on Apr 8, 2015

    @dhermes
    dhermes
    on Apr 8, 2015
    ContributorAuthor
    More actions

    I filed google/apitools#14 to complain about start-up / import times in apitools.

  14. 7 remaining items

  15. dhermes commented on Apr 8, 2015

    @dhermes
    dhermes
    on Apr 8, 2015
    ContributorAuthor
    More actions

    Saw the comment. Is the transfer.RESUMABLE_UPLOAD stuff necessary or can we rely on apitools to handle it?

  16. craigcitro commented on Apr 8, 2015

    @craigcitro
    craigcitro
    on Apr 8, 2015
    Contributor
    More actions

    if you use a generated client, that all goes away. you'll just pass an upload with the request, and (if you set auto_transfer=False) call StreamInChunks afterwards.

  17. dhermes
    closed this as completedin #811on Apr 9, 2015
  18. JustinBeckwith
    assigned
    dhermes
    on Feb 1, 2021
  19. parthea
    added a commit that references this issue on Sep 18, 2025

    chore(deps): update all dependencies (#755)

    d86dd48
  20. parthea
    added 5 commits that reference this issue on Nov 24, 2025

    chore: release 0.40.4 (#755)

    3af2f51

    chore(python): remove obsolete release scripts and config files (#755)

    515530d

    chore: add sync-repo-settings.yaml (#755)

    4e61182

    chore(python): update release.sh to use keystore (#755)

    acab169

    fix(dependencies): add urllib3 and requests to aiohttp extra (#755)

    c1e0555
  21. parthea
    added 4 commits that reference this issue on Mar 2, 2026

    chore(deps): update all dependencies (#755)

    81344e1

    chore(deps): update dependency google-cloud-bigquery to v2.21.0 (#755)

    9af7e74

    chore(deps): update dependency google-cloud-spanner to v3.13.0 (#755)

    94bef2a

    chore(deps): update dependency protobuf to v6.32.1 (#755)

    03d5c34
  22. parthea
    added a commit that references this issue on Sep 8, 2026

    docs: migrate code from googleapis/python-bigquery (#18303)

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

Metadata

Metadata

Assignees

  • @dhermes
    dhermes

Labels

api: coreapi: storageIssues related to the Cloud Storage API.packaging

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.