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

Auto generated code get_distribution method through DistributionNotFound error #200

Closed
HemangChothani opened this issue Sep 18, 2020 · 6 comments · Fixed by #275
Closed
Assignees
Labels
api: pubsub Issues related to the googleapis/python-pubsub API. type: process A process-related concern. May include testing, release, or the like.

Comments

@HemangChothani
Copy link
Contributor

Try statement never executed because of get_distribution(google-pubsub), it should be get_distribution("google-cloud-pubsub",)

try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution("google-pubsub",).version,
)

also found same thing at various places:

gapic_version=pkg_resources.get_distribution("google-pubsub",).version,

gapic_version=pkg_resources.get_distribution("google-pubsub",).version,

gapic_version=pkg_resources.get_distribution("google-pubsub",).version,

gapic_version=pkg_resources.get_distribution("google-pubsub",).version,

@product-auto-label product-auto-label bot added the api: pubsub Issues related to the googleapis/python-pubsub API. label Sep 18, 2020
@HemangChothani HemangChothani added the type: question Request for information or clarification. Not an issue. label Sep 18, 2020
@plamut
Copy link
Contributor

plamut commented Sep 18, 2020

@cguardia This might be another one to get started, feel free to assign yourself if you have capacity.

@meredithslota
Copy link
Contributor

Is this an issue with the code generator or something that should be fixed in the handwritten layers? cc: @anguillanneuf

@anguillanneuf
Copy link
Contributor

anguillanneuf commented Jan 14, 2021

The file structure looks a bit off. Why do we have pubsub and pubsub_v1 nested twice?

This is what we have currently.

- google/ 
  - cloud/
     - pubsub/
     - pubsub_v1/
     - __init__.py
  - pubsub
  - pubsub_v1
  - __init__.py

This is what we should have?

- google/
  - cloud/
     - pubsub/
     - pubsub_v1/
     - __init__.py

I referenced https://github.com/googleapis/python-vision/tree/master/google.

@anguillanneuf anguillanneuf removed the type: question Request for information or clarification. Not an issue. label Jan 14, 2021
@anguillanneuf anguillanneuf self-assigned this Jan 14, 2021
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Jan 14, 2021
@anguillanneuf anguillanneuf removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Jan 14, 2021
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Jan 14, 2021
@plamut
Copy link
Contributor

plamut commented Jan 15, 2021

@anguillanneuf google/cloud/* is the hand-written code, while the code in google/pubsub and google/pubsub_v1 is generated by the microgenerator.

I don't remember exactly why this is the case, it might have been the most straightforward way to avoid any conflicts between the generated code and the hand-written code during the transition to the microgenerator. We might want to refactor this at some point, though, and configure thegenerator to generate the code under google/cloud/pubsub[_v1] to avoid confusion.

@plamut plamut added type: process A process-related concern. May include testing, release, or the like. and removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Jan 15, 2021
@plamut
Copy link
Contributor

plamut commented Jan 15, 2021

Looking at the ClientInfo docstring, gapic_version should be used for gapic-generated libraries. On the other hand, libraries that implement additional features on top the generated code should use the client_library_version argument (which is what get_distribution("google-cloud-pubsub") would return).

We can modify these pieces of generated code and provide the client library version, I'm sure the server-side analytics would benefit from it. If there's no setting in the generator itself, we can still do it through synth.py.

@anguillanneuf
Copy link
Contributor

Thanks Peter for the link to ClientInfo docstring! Sounds like we should go with client_library_version = pkg_resources.get_distribution("google-cloud-pubsub",).version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/python-pubsub API. type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants