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 — Using absolute imports in core modules that import grpc. by dhermes · Pull Request #2632 · googleapis/google-cloud-python

Conversation

@dhermes

@dhermes dhermes commented Oct 27, 2016

Copy link
Copy Markdown
Contributor

This is because a relative import (in Python 2.7) was causing failures when google.cloud.grpc was side-by-side with google.cloud._helpers, etc.

For example, see the failure: https://travis-ci.org/GoogleCloudPlatform/google-cloud-python/builds/171149390#L1738-L1750

FYI @geigerj @bjwatson

To repro (before this PR):

$ cd ${GIT_ROOT}
$ tox -e system-tests --recreate --notest
$ source .tox/system-tests/bin/activate
$ .tox/system-tests/bin/py.test system_tests/datastore.py --pdb
...
>       transport_creds = grpc.ssl_channel_credentials()
E       AttributeError: 'module' object has no attribute 'ssl_channel_credentials'

.tox/system-tests/local/lib/python2.7/site-packages/google/cloud/_helpers.py:643: AttributeError
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> .tox/system-tests/local/lib/python2.7/site-packages/google/cloud/_helpers.py(643)make_secure_stub()
-> transport_creds = grpc.ssl_channel_credentials()
(Pdb) grpc
<module 'google.cloud.grpc' (built-in)>
(Pdb) 

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dhermes
Using absolute imports in core modules that import grpc.
e6c4902
This is because a relative import (in Python 2.7) was
causing failures when google.cloud.grpc was side-by-side with
google.cloud._helpers, etc.
@dhermes dhermes added api: core grpc labels Oct 27, 2016
@dhermes dhermes assigned daspecster and tseaver Oct 27, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 27, 2016
daspecster
daspecster approved these changes Oct 27, 2016
View reviewed changes
@dhermes

dhermes commented Oct 27, 2016

Copy link
Copy Markdown
Contributor Author

@bjwatson ISTM that in later generations of GAPIC generated code the google.cloud.grpc package is gone. Is this correct?

i.e. it is brought in by the speech deps (uploaded on sept. 30)

https://pypi.python.org/pypi/grpc-google-cloud-speech-v1beta1/0.11.1
https://pypi.python.org/pypi/gapic-google-cloud-speech-v1beta1/0.11.1

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes
dhermes merged commit 0838d14 into googleapis:master Oct 27, 2016
@dhermes
dhermes deleted the fix-grpc-rel branch October 27, 2016 18:34
@dhermes

dhermes commented Oct 27, 2016

Copy link
Copy Markdown
Contributor Author

Chatted @bjwatson, he confirmed that google.cloud.grpc is here to stay. For packages like speech where the namespace is google.cloud.speech.v1beta1, putting the autogenerated packages in google.cloud.speech.v1beta1.cloud_speech_pb would cause a collision with our package google.cloud.speech (which isn't a namespace package) so the autogenerated are instead in google.cloud.grpc.speech.v1beta1.cloud_speech_pb

/FYI @jonparrott

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@theacodes

theacodes commented Oct 27, 2016

Copy link
Copy Markdown
Contributor

Yep - remember having that discussion a while back. SGTM.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daspecster daspecster mentioned this pull request Oct 27, 2016
Using google.cloud.operation for GAPIC Speech async? #2629
Closed
richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
@dhermes
Merge pull request googleapis#2632 from dhermes/fix-grpc-rel
6d784ee
Using absolute imports in core modules that import grpc.
@theacodes theacodes unassigned daspecster Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@daspecster daspecster daspecster approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@tseaver tseaver

Labels

api: core cla: yes This human has signed the Contributor License Agreement. grpc

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@dhermes @theacodes @daspecster @tseaver @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.