Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.37k stars 2.71k forks source link

azure-cosmos needs typing updates for mypy version 1.9.0 #33930

Open azure-sdk opened 5 months ago

azure-sdk commented 5 months ago

ACTION NEEDED: This version of mypy will be merged on 2024-07-15. The build will begin to fail for this library if errors are not fixed.

Library name: azure-cosmos Mypy version: 1.9.0 Mypy errors: Link to build (2024-07-07) How to fix: Run the next-mypy tox command at the library package-level and resolve the typing errors. 1) ../azure-cosmos>pip install "tox<5" 2) ../azure-cosmos>tox run -e next-mypy -c ../../../eng/tox/tox.ini --root .

See the Typing Guide for more information.

kristapratico commented 5 months ago

This was opened because there are 10 mypy errors in the samples. It would be great to clean these up so both src and samples are mypy compliant.

samples/examples_async.py:76: error: Incompatible types in assignment (expression has type "Dict[str, Any]", variable has type "ContainerProxy")  [assignment]
samples/examples_async.py:77: error: Value of type "ContainerProxy" is not indexable  [index]
samples/examples.py:69: error: Incompatible types in assignment (expression has type "Dict[str, Any]", variable has type "ContainerProxy")  [assignment]
samples/examples.py:70: error: Value of type "ContainerProxy" is not indexable  [index]
samples/concurrency_sample.py:102: error: Argument 1 to "create_task" has incompatible type "Awaitable[None]"; expected "Union[Generator[Any, None, <nothing>], Coroutine[Any, Any, <nothing>]]"  [arg-type]
samples/access_cosmos_with_resource_token_async.py:181: error: Dict entry 3 has incompatible type "str": "List[str]"; expected "str": "str"  [dict-item]
samples/access_cosmos_with_resource_token_async.py:216: error: Dict entry 2 has incompatible type "str": "Optional[Any]"; expected "str": "str"  [dict-item]
samples/access_cosmos_with_resource_token.py:184: error: Dict entry 3 has incompatible type "str": "List[str]"; expected "str": "str"  [dict-item]
samples/access_cosmos_with_resource_token.py:214: error: Dict entry 2 has incompatible type "str": "Optional[Any]"; expected "str": "str"  [dict-item]
samples/access_cosmos_with_aad.py:77: error: Incompatible types in assignment (expression has type "DefaultAzureCredential", variable has type "ClientSecretCredential")  [assignment]
Found 10 errors in 6 files (checked 26 source files)
github-actions[bot] commented 5 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AbhinavTrips @bambriz @pjohari-ms @simorenoh.

github-actions[bot] commented 5 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AbhinavTrips @bambriz @pjohari-ms @simorenoh.