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

fix: do not crash if distribution cannot be found when extracting semver #393

Merged
merged 2 commits into from
Apr 21, 2021

Conversation

hannahrogers-google
Copy link
Contributor

@hannahrogers-google hannahrogers-google commented Apr 21, 2021

In the case where a user is not running from within a pip package, the google-cloud-pubsub distribution might not be available. At the moment this will cause a fatal DistributionNotFound error because in the publisher and subscriber client, we try to extract the distribution version using 'pkg_resources.get_distribution("google-cloud-pubsub").version'.

In the case where a distribution is not found, making the change to set the version to 0.0.

@hannahrogers-google hannahrogers-google requested a review from a team as a code owner April 21, 2021 16:45
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Apr 21, 2021
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the googleapis/python-pubsub API. label Apr 21, 2021
Copy link
Contributor

@pradn pradn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some context for when this call can throw.

@pradn
Copy link
Contributor

pradn commented Apr 21, 2021

Change looks good! Can you please update the PR summary with some context?

@hannahrogers-google
Copy link
Contributor Author

Change looks good! Can you please update the PR summary with some context?

Yes, I updated the PR summary and added a doc for context in the PR. Thanks, Prad!

@pradn
Copy link
Contributor

pradn commented Apr 21, 2021

Looks good, approved!

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. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants