Skip to content

Unsuppressible mypy syntax error for azure.core when using it from a typechecked project with python 3.9.0 #15762

@christophebiocca

Description

@christophebiocca
  • Package Name: azure.core
  • Package Version: 1.9.0
  • Operating System: Arch Linux
  • Python Version: 3.9.0

Describe the bug
Importing from azure.core.* will cause a hard-to-suppress mypy typechecking error about internal type annotations of azure core that have syntax errors.

I don't understand why it only happens on 3.9.0.

Note that mypy has a really hard time with syntax errors: python/mypy#6897 which makes it hard for the end user to ignore them.

To Reproduce

  1. Clone https://github.com/EncircleInc/azure-core-mypy-error
  2. pip install -r requirements.lock.txt file.
  3. mypy -p test. You'll get something like .../python3.9/site-packages/azure/core/pipeline/policies/_authentication.py:33: error: syntax error in type comment '(TokenCredential, *str, Mapping[str, Any]) -> None
  4. Try to suppress the error by adding ignore_errors = True in the mypy.ini file.
  5. mypy -p test still errors out.

Expected behavior
No type errors when using default mypy settings, or an error saying there aren't any types available.

Metadata

Metadata

Assignees

Labels

Azure.CoreClientThis issue points to a problem in the data-plane of the library.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions