[Core] Add @runtime_checkable to TokenCredential protocol definitions#25187
[Core] Add @runtime_checkable to TokenCredential protocol definitions#25187mccoyp merged 1 commit intoAzure:mainfrom
@runtime_checkable to TokenCredential protocol definitions#25187Conversation
xiangyan99
left a comment
There was a problem hiding this comment.
Let's split them into two separate PRs: core-only and non-core.
|
API change check APIView has identified API level changes in this PR and created following API reviews. |
xiangyan99
left a comment
There was a problem hiding this comment.
Do you want to add it into changelog?
|
@xiangyan99 good point, it probably would be worth adding. I am just now noticing, though, that this isn't supported in Python 3.7. This'll need some reworking, unfortunately 🤔 |
lmazuel
left a comment
There was a problem hiding this comment.
Change my approve to comment, as we need 3.6 support. Maybe Krista has an idea.
I guess what you wanted to say is we wanted 3.7 support? |
|
@mccoyp we're dropping
yeah :p |
|
Yeah, this won't work because 3.7 doesn't support it 😔 And it doesn't solve the motivating issue (see this comment), so we'll need a different approach completely. I don't think this change (rather, a 3.7-compatible version) is a bad idea, because being able to do an |
|
@mccoyp , ok let's try to reproduce already, it should be possible. Once we understand that, we'll talk about solution. |
d539a39 to
43fcc18
Compare
|
Identity CI failure is unrelated, and a fix is proposed here: #25787 Overriding check enforcer to merge since everything else is a-okay 🙂 |
|
/check-enforcer override |
Description
See #25175. With this PR, doing an
isinstancecheck with anazure-identitycredential and aTokenCredentialprotocol returns True -- that check errors today since these protocols aren't runtime checkable.isinstanceandissubclasschecks aren't available without@runtime_checkable, but explicitly declaring theTokenCredentialimplementation (as shown below) could possibly satisfy static type checkers.All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines