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

process: add mypy session for samples #551

Merged
merged 11 commits into from Jan 17, 2022
Merged

Conversation

plamut
Copy link
Contributor

@plamut plamut commented Dec 17, 2021

Towards #536.

This PR adds the mypy session for samples and cleans up their type annotations.

However, the PR does not address the errors caused by mypy not realizing that a lot of methods from the generated client are dynamically injected into the hand written class. It also does not deal with a few missing annotations in google-api-core (e.g. retry.Retry).

Additional thing to consider is that the client classes that the end users use now have many more methods on them that were previously stored on their client.api attribute (and the .api attribute has been removed). Caution is needed here.

@plamut plamut requested a review from pradn December 17, 2021 15:33
@plamut plamut requested review from a team as code owners December 17, 2021 15:33
@plamut plamut requested a review from dandhlee December 17, 2021 15:33
@product-auto-label product-auto-label bot added api: pubsub Issues related to the googleapis/python-pubsub API. samples Issues that are directly related to samples. labels Dec 17, 2021
@plamut
Copy link
Contributor Author

plamut commented Dec 17, 2021

Hm... this will likely not be mergeable, because mypy_samples currently fails (as a part of the main Kokoro run). Probably best to temporarily disable that session until the clients are refactored to directly subclass generated classes instead of dynamically injecting methods from it.

@plamut plamut added the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 17, 2021
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 17, 2021
@plamut plamut force-pushed the iss-536-samples branch 2 times, most recently from c80c04e to 5fe8d2b Compare December 17, 2021 15:48
@plamut plamut added the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 17, 2021
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 17, 2021
@plamut plamut added the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 17, 2021
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 17, 2021
@plamut plamut added the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 17, 2021
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 17, 2021
@plamut plamut added the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 17, 2021
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 17, 2021
@plamut plamut added the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 20, 2021
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 20, 2021
@plamut plamut added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 20, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 20, 2021
@plamut plamut added the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 20, 2021
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 20, 2021
@plamut plamut added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 20, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 20, 2021
The version pins that require recent enough depndencies for the sake
of static type analysis should be placed in the corresponding nox
session definition. They should not interfere with dependency versions
used for testing the code at runtime, i.e. when running the tests.
@plamut plamut added the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 27, 2021
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 27, 2021
@plamut plamut added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 28, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 28, 2021
Copy link
Contributor

@tswast tswast left a comment

Choose a reason for hiding this comment

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

LGTM except for a couple of nits.

google/cloud/pubsub_v1/publisher/futures.py Outdated Show resolved Hide resolved
noxfile.py Show resolved Hide resolved
@tswast tswast added the automerge Merge the pull request once unit tests and other checks pass. label Jan 12, 2022
@gcf-merge-on-green
Copy link

Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, one of your required reviews was not approved, or there is a do not merge label. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot.

@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Jan 13, 2022
@anguillanneuf anguillanneuf added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 15, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 15, 2022
@dandhlee dandhlee merged commit a861848 into googleapis:main Jan 17, 2022
@plamut plamut deleted the iss-536-samples branch January 18, 2022 07:08
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. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants