-
Notifications
You must be signed in to change notification settings - Fork 309
Description
Feature Request
Add type hints to the python package, for both native python code and compiled code.
Description
Type hints are incredibly value in modern python, particularly for library code that may be unknown to developers! Type hints allow our IDEs to auto-complete, catch errors, and make simplify code discovery. I know not everybody loves type hints, but as a library, I believe OpenTimelineIO would benefit a lot from them in terms of automatic tooling integration and developer onboarding!
This is obviously pretty easy in the native python code, but in the pybind11 code it's slightly more tricky. Theoretically you can use mypy stubgen
to do this with compiled modules? Is there a native pybind11 way of doing this? I'm not a C++ developer and have never touched pybind, so unfortunately I don't know for sure what the ideal workflow is here.
At my job, we have a mypy validated package that uses OpenTimelineIO, and I've spent a few hours trying to set up my own stub files for OTIO using mypy stubgen. It works fairly well, but it's not perfect. Possibly good enough for release though!
Perhaps this is a two parter -
- Add type hints to external facing python code (easy)
- At package build/deploy time, use a command like
mypy stubgen -m opentimelineio
to generate .pyi files to be included in the package.
Context
Add any other context here, such as simulated output, or screenshots, that might help clarify the request.