temoa icon indicating copy to clipboard operation
temoa copied to clipboard

Enhance Pyomo type stubs with more specific typing

Open coderabbitai[bot] opened this issue 2 months ago • 0 comments

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:

  1. More specific type signatures for value(), sum_product(), and quicksum()

    • Currently these return Any, which is pragmatic but could be made more precise
  2. Generic type parameters for indexed components

    • For example: PyomoParam[T], PyomoVar[T]
    • This would provide better type safety for indexed access
  3. More detailed PyomoComponent protocol 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.

coderabbitai[bot] avatar Oct 17 '25 16:10 coderabbitai[bot]