René's URL Explorer Experiment


Title: feat: add type annotations to wrapped grpc calls by daniel-sanche · Pull Request #554 · googleapis/python-api-core · GitHub

Open Graph Title: feat: add type annotations to wrapped grpc calls by daniel-sanche · Pull Request #554 · googleapis/python-api-core

X Title: feat: add type annotations to wrapped grpc calls by daniel-sanche · Pull Request #554 · googleapis/python-api-core

Description: Our gapic libraries declare that they return Iterable[SomeProto] or Awaitable[SomeProto] or Awaitable[AsyncIterable[SomeProto], but that doesn't tell the whole story. The objects returned are actually grpc.Call subclasses, which expose the ability to retrieve metadata from the rpc, or call cancel, or other trigger useful functionality. Unfortunately, there is currently no way to use these grpc.Call methods without mypy errors, because of the restrictive return type annotation used This PR is the first step in addressing this, by giving us a more powerful return type in api-core. On the sync side, I made _StreamingResponseIterator into a Generic container, and gave it a better public facing name. This way, we we can return GrpcStream[SomeProto] instead of Iterable[SomeProto], with all grpc.Call methods accessible On the Async side, I made every _WrappedXYResponse class into a Generic container, and declared new GrpcAsyncStream[SomeProto] and AwaitableGrpcCall[SomeProto] types that can be used in place of AsyncIterable[SomeProto] and Awaitable[SomeProto] respectively. For more context on the motivating problem, see googleapis/gapic-generator-python#1856. This PR lays some of the groundwork for resolving that issue in the future. But the type improvements here should also stand alone

Open Graph Description: Our gapic libraries declare that they return Iterable[SomeProto] or Awaitable[SomeProto] or Awaitable[AsyncIterable[SomeProto], but that doesn't tell the whole story. The objects returned are a...

X Description: Our gapic libraries declare that they return Iterable[SomeProto] or Awaitable[SomeProto] or Awaitable[AsyncIterable[SomeProto], but that doesn't tell the whole story. The objects returned a...

Opengraph URL: https://github.com/googleapis/python-api-core/pull/554

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:444a92a8-956d-fa5b-5661-a020aee12521
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9D48:232221:115AD58:11BEB9F:6A4DCDFD
html-safe-nonce5a548a91032b6c348322574bb9eb1d9e31c76c9d55032faf06a7dbb21adb92d1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDQ4OjIzMjIyMToxMTVBRDU4OjExQkVCOUY6NkE0RENERkQiLCJ2aXNpdG9yX2lkIjoiNDA4MzU4ODY2NTUzOTY3NzY5MyIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9
visitor-hmac8b173c49f1eba7e5207617a3f2f0e1b6c30a51450a4e7e690cd4ec0b9d7ddcce
hovercard-subject-tagpull_request:1605507699
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/googleapis/python-api-core/pull/554/files
twitter:imagehttps://avatars.githubusercontent.com/u/3914119?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/3914119?s=400&v=4
og:image:altOur gapic libraries declare that they return Iterable[SomeProto] or Awaitable[SomeProto] or Awaitable[AsyncIterable[SomeProto], but that doesn't tell the whole story. The objects returned are a...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/googleapis/python-api-core git https://github.com/googleapis/python-api-core.git
octolytics-dimension-user_id16785467
octolytics-dimension-user_logingoogleapis
octolytics-dimension-repository_id226992456
octolytics-dimension-repository_nwogoogleapis/python-api-core
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id226992456
octolytics-dimension-repository_network_root_nwogoogleapis/python-api-core
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release1d344bdb7547fe6bca17a59bb2b8aac3dc9532a0
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/googleapis/python-api-core/pull/554/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fpython-api-core%2Fpull%2F554%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fpython-api-core%2Fpull%2F554%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=googleapis%2Fpython-api-core
Reloadhttps://github.com/googleapis/python-api-core/pull/554/files
Reloadhttps://github.com/googleapis/python-api-core/pull/554/files
Reloadhttps://github.com/googleapis/python-api-core/pull/554/files
Please reload this pagehttps://github.com/googleapis/python-api-core/pull/554/files
googleapis https://github.com/googleapis
python-api-corehttps://github.com/googleapis/python-api-core
Notifications https://github.com/login?return_to=%2Fgoogleapis%2Fpython-api-core
Fork 97 https://github.com/login?return_to=%2Fgoogleapis%2Fpython-api-core
Star 144 https://github.com/login?return_to=%2Fgoogleapis%2Fpython-api-core
Code https://github.com/googleapis/python-api-core
Issues 0 https://github.com/googleapis/python-api-core/issues
Pull requests 0 https://github.com/googleapis/python-api-core/pulls
Actions https://github.com/googleapis/python-api-core/actions
Projects https://github.com/googleapis/python-api-core/projects
Security and quality 0 https://github.com/googleapis/python-api-core/security
Insights https://github.com/googleapis/python-api-core/pulse
Code https://github.com/googleapis/python-api-core
Issues https://github.com/googleapis/python-api-core/issues
Pull requests https://github.com/googleapis/python-api-core/pulls
Actions https://github.com/googleapis/python-api-core/actions
Projects https://github.com/googleapis/python-api-core/projects
Security and quality https://github.com/googleapis/python-api-core/security
Insights https://github.com/googleapis/python-api-core/pulse
daniel-sanchehttps://github.com/daniel-sanche
mainhttps://github.com/googleapis/python-api-core/tree/main
type-annotate-grpc-wrappershttps://github.com/googleapis/python-api-core/tree/type-annotate-grpc-wrappers
Conversation 6 https://github.com/googleapis/python-api-core/pull/554
Commits 16 https://github.com/googleapis/python-api-core/pull/554/commits
Checks 0 https://github.com/googleapis/python-api-core/pull/554/checks
Files changed https://github.com/googleapis/python-api-core/pull/554/files
Please reload this pagehttps://github.com/googleapis/python-api-core/pull/554/files
feat: add type annotations to wrapped grpc calls https://github.com/googleapis/python-api-core/pull/554/files#top
Show all changes 16 commits https://github.com/googleapis/python-api-core/pull/554/files
709eb49 add types to grpc call wrappers daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/709eb497790f1111c84fd62e4f9cecef9a0440cf
2026974 fixed tests daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/202697441ae923f4f2b8b1d229bebc1f39e44619
f65b0c7 🦉 Updates from OwlBot post-processor gcf-owl-bot[bot] Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/f65b0c73d6e906875f3baf7f3d403875f598ee31
373ef40 changed type daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/373ef40e66d688af8c97ba7268315bcc64125d22
2c20dec changed async types daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/2c20dec01615e46861fb2688971266d2e51912ca
430e033 added tests daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/430e0336a8bdc22656354818d1542d1cac942983
3cf50bb fixed lint issues daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/3cf50bb806b690deae160d4134ac6a7206e047a1
4f8fbcd Merge branch 'main' into type-annotate-grpc-wrappers daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/4f8fbcd9b0bb877995f6f54bb977eeec31e037d7
b817527 Update tests/asyncio/test_grpc_helpers_async.py daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/b817527c6173505b013dc37861061faf10550750
623becd turned GrpcStream into a type alias daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/623becd2197db3ebd0e607b0fc19a9c960091086
781cdee added test for GrpcStream daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/781cdeeaf269c7d699116a6b9f4c45e359c6a0bf
9c3cd54 🦉 Updates from OwlBot post-processor gcf-owl-bot[bot] Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/9c3cd541ac37fdec0b6961064766f1bc661568c0
5d674e7 added comment daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/5d674e7fc615ab8a2a4087114fcee3ae093ba297
06a5ea9 reordered types daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/06a5ea9572f77c043ebe4826b6f7a710e21e08fc
10ef5bf changed type var to P daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/10ef5bf0d9a3be7d4d466fa504e0447479c1bee0
7e43af7 Merge branch 'main' into type-annotate-grpc-wrappers daniel-sanche Nov 17, 2023 https://github.com/googleapis/python-api-core/pull/554/commits/7e43af7a6749c4a902e4c57611b7de0d1fbd554d
Clear filters https://github.com/googleapis/python-api-core/pull/554/files
Please reload this pagehttps://github.com/googleapis/python-api-core/pull/554/files
Please reload this pagehttps://github.com/googleapis/python-api-core/pull/554/files
grpc_helpers.py https://github.com/googleapis/python-api-core/pull/554/files#diff-9aeb5107dac746ab0e51a30c001ca48df095ca511bc881c40ed0c5e71cf7dc73
grpc_helpers_async.py https://github.com/googleapis/python-api-core/pull/554/files#diff-8d7fc40ae297f573cfea6aed00f8fe073f211a84ac0b9aa6961745030ee1d76b
test_grpc_helpers_async.py https://github.com/googleapis/python-api-core/pull/554/files#diff-674e40c61f15aa7ba281c08b5ae7d3231c02189806f9c3b53b3e9a656815d2c5
test_grpc_helpers.py https://github.com/googleapis/python-api-core/pull/554/files#diff-a2ab7509503191e922431f02fd347dd02debe706b046872c0ee6f41785fd0acb
google/api_core/grpc_helpers.pyhttps://github.com/googleapis/python-api-core/pull/554/files#diff-9aeb5107dac746ab0e51a30c001ca48df095ca511bc881c40ed0c5e71cf7dc73
View file https://github.com/googleapis/python-api-core/blob/7e43af7a6749c4a902e4c57611b7de0d1fbd554d/google/api_core/grpc_helpers.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/googleapis/python-api-core/pull/554/{{ revealButtonHref }}
https://github.com/googleapis/python-api-core/pull/554/files#diff-9aeb5107dac746ab0e51a30c001ca48df095ca511bc881c40ed0c5e71cf7dc73
https://github.com/googleapis/python-api-core/pull/554/files#diff-9aeb5107dac746ab0e51a30c001ca48df095ca511bc881c40ed0c5e71cf7dc73
https://github.com/googleapis/python-api-core/pull/554/files#diff-9aeb5107dac746ab0e51a30c001ca48df095ca511bc881c40ed0c5e71cf7dc73
https://github.com/googleapis/python-api-core/pull/554/files#diff-9aeb5107dac746ab0e51a30c001ca48df095ca511bc881c40ed0c5e71cf7dc73
https://github.com/googleapis/python-api-core/pull/554/files#diff-9aeb5107dac746ab0e51a30c001ca48df095ca511bc881c40ed0c5e71cf7dc73
https://github.com/googleapis/python-api-core/pull/554/files#diff-9aeb5107dac746ab0e51a30c001ca48df095ca511bc881c40ed0c5e71cf7dc73
https://github.com/googleapis/python-api-core/pull/554/files#diff-9aeb5107dac746ab0e51a30c001ca48df095ca511bc881c40ed0c5e71cf7dc73
https://github.com/googleapis/python-api-core/pull/554/files#diff-9aeb5107dac746ab0e51a30c001ca48df095ca511bc881c40ed0c5e71cf7dc73
google/api_core/grpc_helpers_async.pyhttps://github.com/googleapis/python-api-core/pull/554/files#diff-8d7fc40ae297f573cfea6aed00f8fe073f211a84ac0b9aa6961745030ee1d76b
View file https://github.com/googleapis/python-api-core/blob/7e43af7a6749c4a902e4c57611b7de0d1fbd554d/google/api_core/grpc_helpers_async.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/googleapis/python-api-core/pull/554/{{ revealButtonHref }}
https://github.com/googleapis/python-api-core/pull/554/files#diff-8d7fc40ae297f573cfea6aed00f8fe073f211a84ac0b9aa6961745030ee1d76b
https://github.com/googleapis/python-api-core/pull/554/files#diff-8d7fc40ae297f573cfea6aed00f8fe073f211a84ac0b9aa6961745030ee1d76b
https://github.com/googleapis/python-api-core/pull/554/files#diff-8d7fc40ae297f573cfea6aed00f8fe073f211a84ac0b9aa6961745030ee1d76b
https://github.com/googleapis/python-api-core/pull/554/files#diff-8d7fc40ae297f573cfea6aed00f8fe073f211a84ac0b9aa6961745030ee1d76b
https://github.com/googleapis/python-api-core/pull/554/files#diff-8d7fc40ae297f573cfea6aed00f8fe073f211a84ac0b9aa6961745030ee1d76b
https://github.com/googleapis/python-api-core/pull/554/files#diff-8d7fc40ae297f573cfea6aed00f8fe073f211a84ac0b9aa6961745030ee1d76b
tests/asyncio/test_grpc_helpers_async.pyhttps://github.com/googleapis/python-api-core/pull/554/files#diff-674e40c61f15aa7ba281c08b5ae7d3231c02189806f9c3b53b3e9a656815d2c5
View file https://github.com/googleapis/python-api-core/blob/7e43af7a6749c4a902e4c57611b7de0d1fbd554d/tests/asyncio/test_grpc_helpers_async.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/googleapis/python-api-core/pull/554/{{ revealButtonHref }}
https://github.com/googleapis/python-api-core/pull/554/files#diff-674e40c61f15aa7ba281c08b5ae7d3231c02189806f9c3b53b3e9a656815d2c5
https://github.com/googleapis/python-api-core/pull/554/files#diff-674e40c61f15aa7ba281c08b5ae7d3231c02189806f9c3b53b3e9a656815d2c5
tests/unit/test_grpc_helpers.pyhttps://github.com/googleapis/python-api-core/pull/554/files#diff-a2ab7509503191e922431f02fd347dd02debe706b046872c0ee6f41785fd0acb
View file https://github.com/googleapis/python-api-core/blob/7e43af7a6749c4a902e4c57611b7de0d1fbd554d/tests/unit/test_grpc_helpers.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/googleapis/python-api-core/pull/554/{{ revealButtonHref }}
https://github.com/googleapis/python-api-core/pull/554/files#diff-a2ab7509503191e922431f02fd347dd02debe706b046872c0ee6f41785fd0acb
https://github.com/googleapis/python-api-core/pull/554/files#diff-a2ab7509503191e922431f02fd347dd02debe706b046872c0ee6f41785fd0acb
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.