temoa
temoa copied to clipboard
Enhance Pyomo type stubs with more specific typing
Context
During the review of PR #165 (typing first pass), we identified potential enhancements to the Pyomo type stubs in temoa/types/pyomo_stubs.pyi.
Reference:
- PR: https://github.com/TemoaProject/temoa/pull/165
- Comment: https://github.com/TemoaProject/temoa/pull/165#discussion_r2438054841
- Requested by: @ParticularlyPythonicBS
Proposed Enhancements
The current stub file provides a solid foundation for type checking Pyomo-related code. For future iterations, these stubs could be enhanced with:
-
More specific type signatures for
value(),sum_product(), andquicksum()- Currently these return
Any, which is pragmatic but could be made more precise
- Currently these return
-
Generic type parameters for indexed components
- For example:
PyomoParam[T],PyomoVar[T] - This would provide better type safety for indexed access
- For example:
-
More detailed
PyomoComponentprotocol methods- Expand the protocol to include additional common methods used in Temoa
Notes
These enhancements are not urgent and should not block the current typing work in PR #165. This issue is to track them for a future iteration when stricter typing is desired.