When I try to run mypy
in my project that has PyDrake as a depencency I get: venv/lib/python3.9/site-packages/pydrake/common/eigen_geometry.pyi:30: error: invalid syntax
The line in questions is: def cast[AutoDiffXd](self, *args, **kwargs) -> Any: ...
. I'm assuming this has something to do with PyDrake's custom templating system. How can I make MyPy and PyDrake play nice?
Environment Info
As of the current version of Drake (v1.12.0), we unfortunately do not support Mypy. The purpose of the *.pyi
files as of today is solely to enable VSCode suggestion auto-complete.
We didn't have a central issue tracking this, so I've filed a new one. Hopefully we can remove the syntax errors down the road.
The only work-around I know of for today is to delete the *.pyi
files if you use Mypy.