robotpy / robotpy-commands-v2

Python implementation of the WPILib Command Framework (2020+)
Other
2 stars 14 forks source link

One option for adding generic types #56

Closed cwstryker closed 1 month ago

cwstryker commented 3 months ago

It seems like there is a strong desire to implement better typing in the robotpy-commands-v2 library. There are potentially several ways to improve typing. The approach shown here uses TypeVar to create a generic type of ProfiledPIDController, named GenericProfiledPIDController. The generic type is defined in new typing.py file. The new generic type is then used in profiledpidsubsystem.py file as a type hint. See the file differences for more details.

Advantages:

cwstryker commented 3 months ago

If this sounds like a good path forward, I'll work on adding more generic types are time permits.

virtuald commented 1 month ago

This seems great. Any reason not to merge it in at this point?

cwstryker commented 1 month ago

It's ready to merge.