1 year ago

#382274

test-img

thevoiddancer

Raising DeprecationWarning in mypy for PEP 585

In a project I'm working on we're extensively using type hinting. And we're now updating to python 3.9, with it's expanded type hinting functionality defined in PEP 585. And testing the change I ran into an interesting issue.

PEP 585 states:

Importing those from typing is deprecated. Due to PEP 563 and the intention to minimize the runtime impact of typing, this deprecation will not generate DeprecationWarnings. Instead, type checkers may warn about such deprecated usage when the target version of the checked program is signalled to be Python 3.9 or newer. It’s recommended to allow for those warnings to be silenced on a project-wide basis.

But running mypy on code containing the old typing way (for example: tp.List[str] instead of list[str]) mypy raises no deprecation warning, or any kind of warning for that matter.

What am I missing?

python

mypy

python-3.9

pep585

0 Answers

Your Answer

Accepted video resources