Python Type Checker Mypy receives experimental semantic analyzer

Mypy is an optional static type checker for Python. In version 0.710 he brings along a new feature: an experimental semantic analyzer. The details were presented by Guido van Rossum on the Mypy blog.

In PEP 484 type hints for Python were introduced, whereupon static type checking became possible. One of the tools developed for this purpose is Mypy. Python inventor Guido van Rossum is also involved in the project, which is why he presented the new semantic analyzer and the other features in Mypy 0.710 in a blog entry.

Experimental semantic analyzer

The new release Mypy 0.710 has an experimental semantic analyzer on board. The new component binds names to definitions. It should keep track of what each name defines, eg. For example, a function or a type alias. It is a revised version of the semantic analyzer, which is why it is called a new semantic analyzer. Above all, the handling of import cycles and forward references should have improved in the new version.

The new semantic analyzer can be activated in two ways: either through the command-line –new-semantic-analyzer or by setting new_semantic_analyzer = True in the Mypy configuration file, usually mypi.ini . For more information about activation, see the documentation .

Other features in Mypy 0.710

Other new features in version 0.710 include additional in-line configuration capabilities. By per-file configuration flags in # Mypy: comments z. Eg # Mypy: no-strict-optional at the beginning of the file. This will disable strict optional checking for this file. In addition, the new release contains some more new features as well as inference improvements and bug fixes.

Mypy is available via PyPI (Python Package Index) . There is already the current version 0.711 ready, which fixes two minor bugs from Mypy 0.710.

On the Mypy blog, Guido van Rossum introduced the new features in version 0.710 and described the bug fixes in version 0.711.

LEAVE A REPLY

Please enter your comment!
Please enter your name here