Are you using Python type annotations? Having fun with mypy
? Microsoft created some years ago yet another static type checker called Pyright.
Static Type Checker for Python
Pyright is a full-featured, standards-based static type checker for Python. It is designed for high performance and can be used with large Python source bases.
Pyright includes both a command-line tool and an extension for Visual Studio Code.
Documentation
Refer to the documentation for installation, configuration, and usage details.
Community
Do you have questions about Pyright or Python type annotations in general? Post your questions in the discussion section.
If you would like to report a bug or request an enhancement, file a new issue in either the pyright or pylance-release issue tracker. In general, core type checking functionality is associated with Pyright while language service functionality is associated with Pylance, but the same contributors monitor both repos. For best results, provide the information requested in the issue template.
Contributing
This project welcomes contributions and suggestions. For feature and complex bug fix contributions…
Some devs said it has a very great speed compared to mypy. I haven't used for any of my project's CI pipeline yet but I have this VSCode extension which, if you use this editor for your Python projects, you will be grateful on how it catches bugs caused by typing issues. So far it catches more issues than mypy
and its messages are somehow clearer.
Being both VSCode and Pyright built with JavaScript (yes, Pyright was written in JS), their integration is pretty sweet. Although you can integrate to your favorite editor (vim, emacs, etc...).
The CLI is pretty similar to mypy
. I'd suggest to give it a try and let me know how was your experience using it.
Wanna know how to start using type annotations in Python? Check out my tutorial published by Stack Builders.
Top comments (0)