-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Abstract
This feature request will add Python PEP-484 compliant type hints to the Python module.
Motivation
The use of static type hinting in Python is increasingly recognized as best practice, and many IDE and text editor tools (for example, PyCharm and VS Code + Python extension) ship with support for static type checking. This improves correctness of code, especially for larger scripts and projects. In addition, type hinting is entirely opt-in and does not affect runtime behavior in any way.
Possible Solutions
There are two possible solutions. One is to use the existing Cython types (where they exist) and add the missing ones in the existing Python module. I'm not sure if this is possible or not.
Alternatively, we can ship (either as part of the main Cantera package, or in a separate "stubs" package) a stub file that describes the interface. Ideally, this file could be partly autogenerated during build, most likely from a template.
References
https://mypy.readthedocs.io/en/stable/installed_packages.html#making-pep-561-compatible-packages
https://mypy.readthedocs.io/en/stable/getting_started.html#stubs-intro
https://mypy.readthedocs.io/en/stable/stubs.html