robotpy / robotpy-wpilib

Moved to https://github.com/robotpy/mostrobotpy
https://robotpy.github.io
Other
170 stars 60 forks source link

Auto-generated type annotations? #674

Closed bvisness closed 3 years ago

bvisness commented 3 years ago

Our team is exploring switching from Java to Python sometime in the coming seasons, and we're exploring how type checking can fit into that. We've had some success getting mypy working with handwritten type stubs, but that gets old fast.

I noticed that the robotpy docs have robust types for everything, including third-party packages. What would it take to generate type stubs (or type-annotated Python code) with that same information?

I was digging into this myself a bit early this year, but got a bit lost trying to find out how the docs are built. I'm absolutely willing to work on this myself if somebody can point me in the right direction.

virtuald commented 3 years ago

The right way to do this is to modify/leverage robotpy-build to generate the type stubs. Some investigation has already been done on this, but definitely would be interested in someone finishing up the work. See https://github.com/robotpy/robotpy-build/issues/1 .

virtuald commented 3 years ago

If you want to tackle this problem, I'd be happy to chat with you (either on our Gitter channel or via some voice like Google Meet/whatever) sometime about how the docs are built and some of the challenges that we've faced regarding type annotations. Let me know -- I suspect this would be a much appreciated feature by RobotPy teams!