You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Client creation with DefaultAzureCredential raises PyCharm typing warning #25175
Per #25144, opened by Søren Skov Eriksen (@soer7022). As shown in the screenshot below, PyCharm sometimes raises a flag for incorrect typing when creating a Key Vault SecretClient with a DefaultAzureCredential.
DefaultAzureCredential is an implementation of the TokenCredential protocol, so the typing is correct (and the type hint on the KV client should be kept as-is for generality). However, we should find a way to indicate this protocol implementation in a way that prevents false flags like this.
Running isinstance(DefaultAzureCredential, TokenCredential) currently raises an error because TokenCredential isn't decorated with @runtime_checkable, but adding this decorator and running the statement returns True (mypy doesn't raise an error with or without the decorator). This may be the fix we need, but there may be more to do here -- refer to PEP 544 for more information.
Hi Søren Skov Eriksen (@soer7022)! When you get a chance, would you be willing to try applying the changes from #25187 to your local azure-core package to see if that resolves the issue? I haven't been able to reproduce the warning, possibly because I'm not using PyCharm's professional edition.
If that doesn't work, I'd be curious to see if the explicit implementation declaration that I described in the linked PR's description would do the trick.
Unfortunately, the changes in the PR did not fix it. And neither did the ones described in the description...
Did you try updating your PyCharm to a 2022 version? 😄
Hmmm... I wasn't able to keep looking into this today, but I'll keep trying to repro and provide an update as soon as possible. I updated my PyCharm yesterday, but I'll see if there are updates I'm missing -- thank you for your patience!
Hi again Søren Skov Eriksen (@soer7022) -- sorry about the delayed response on this, but I was able to reproduce the warning after updating to Community Edition 2022.1.3 🙂 I'll provide an update again as soon as possible.
Hi Jonathan Lipman (@jlipmanDig), I'm working on this issue now and we'll hopefully have a fix included in the next azure-identity release after this week's. A PR should be up later this week -- apologies for the delay.
Activity
soer7022 commentedon Jul 12, 2022
The screenshot is from my system, I'm running the following:
laiapat commentedon Jul 12, 2022
Hi Søren Skov Eriksen (@soer7022)! When you get a chance, would you be willing to try applying the changes from #25187 to your local
azure-corepackage to see if that resolves the issue? I haven't been able to reproduce the warning, possibly because I'm not using PyCharm's professional edition.If that doesn't work, I'd be curious to see if the explicit implementation declaration that I described in the linked PR's description would do the trick.
soer7022 commentedon Jul 13, 2022
Unfortunately, the changes in the PR did not fix it. And neither did the ones described in the description...
Did you try updating your PyCharm to a 2022 version? 😄
laiapat commentedon Jul 14, 2022
Hmmm... I wasn't able to keep looking into this today, but I'll keep trying to repro and provide an update as soon as possible. I updated my PyCharm yesterday, but I'll see if there are updates I'm missing -- thank you for your patience!
laiapat commentedon Jul 27, 2022
Hi again Søren Skov Eriksen (@soer7022) -- sorry about the delayed response on this, but I was able to reproduce the warning after updating to Community Edition 2022.1.3 🙂 I'll provide an update again as soon as possible.
laiapat commentedon Aug 20, 2022
A PR is now up to fix this: #25788
5 remaining items
jlipmanDig commentedon Jul 9, 2023
Hi, any update on this issue? we're facing something similar which forces us to silence the type-checking for azure credentials
laiapat commentedon Jul 10, 2023
Hi Jonathan Lipman (@jlipmanDig), I'm working on this issue now and we'll hopefully have a fix included in the next
azure-identityrelease after this week's. A PR should be up later this week -- apologies for the delay.jlipmanDig commentedon Jul 11, 2023
Thanks @mccoyp! Looking forward to it 😊