Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

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

Merged
pradn merged 2 commits into
googleapis:masterfrom
hannahrogers-google:master
Apr 21, 2021
Merged

fix: do not crash if distribution cannot be found when extracting semver#393
pradn merged 2 commits into
googleapis:masterfrom
hannahrogers-google:master

Conversation

@hannahrogers-google

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

Copy link
Copy Markdown
Contributor

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 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

@pradn pradn left a comment

Copy link
Copy Markdown
Contributor

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

pradn commented Apr 21, 2021

Copy link
Copy Markdown
Contributor

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

@hannahrogers-google

Copy link
Copy Markdown
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

pradn commented Apr 21, 2021

Copy link
Copy Markdown
Contributor

Looks good, approved!

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

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