azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

Track 2 SDKs should support PEP561 to enable mypy for customers

Open lmazuel opened this issue 6 years ago • 6 comments

I just discovered that if a package is shipped using typing in comments annotation, it's actually ignored by mypy when used on a client code:

> mypy .\code.py
code.py:1: error: No library stub file for module 'azure.core'
code.py:1: note: (Stub files are from https://github.com/python/typeshed)
Found 1 error in 1 file (checked 1 source file)

To enable that scenario, we need to put a "py.typed" empty file at the root of the namespace, and mypy will then scan for comments annotations. The previous run now becomes:

> mypy .\code.py
Success: no issues found in 1 source file

Reference:

lmazuel avatar Jan 23 '20 18:01 lmazuel

Fixed azure.core in #9577

xiangyan99 avatar Jan 24 '20 19:01 xiangyan99

Just checked - text analytics, form recognizer, metrics advisor, and document translation have py.typed files

kristapratico avatar Apr 26 '21 22:04 kristapratico

Tables has a py.typed. Container Registry and AppConfiguration do not.

seankane-msft avatar Apr 26 '21 22:04 seankane-msft

Eventgrid and monitor don't have a py.typed https://github.com/Azure/azure-sdk-for-python/issues/18324 https://github.com/Azure/azure-sdk-for-python/issues/18323

rakshith91 avatar Apr 26 '21 23:04 rakshith91

Identity doesn't have one: #18325

chlowell avatar Apr 26 '21 23:04 chlowell

EventHubs, ServiceBus, SchemaRegistry don't have a py.typed

https://github.com/Azure/azure-sdk-for-python/issues/18344 https://github.com/Azure/azure-sdk-for-python/issues/18345 https://github.com/Azure/azure-sdk-for-python/issues/18346

yunhaoling avatar Apr 27 '21 12:04 yunhaoling