Problem
Sometimes, attributes and variables are only defined for a specific implementation.
E.g. I recently saw that PyPy has a sys.pypy_version_info variable.
At the moment, type checkers only support sys.version_info and sys.platform checks AFAIK.1
Idea
Add support for sys.implementation.name2 checks.
import sys
if sys.implementation.name == "pypy":
pypy_version_info: ...
Problem
Sometimes, attributes and variables are only defined for a specific implementation.
E.g. I recently saw that
PyPyhas asys.pypy_version_infovariable.At the moment, type checkers only support
sys.version_infoandsys.platformchecks AFAIK.1Idea
Add support for
sys.implementation.name2 checks.Footnotes
https://mypy.readthedocs.io/en/stable/common_issues.html?highlight=sys.platform#python-version-and-system-platform-checks ↩
https://peps.python.org/pep-0421/#required-attributes ↩