chore: fix typing with new highspy version#795
Merged
Conversation
highspy's changeColsIntegrality expects var_types as a uint8 array (matching HiGHS's uint8-backed HighsVarType enum). The persistent update path already builds it as uint8 (_apply_var_types); align the direct-solve path so it matches highspy's tightened type stubs and is robust across versions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merging this PR will not alter performance
Comparing Footnotes
|
highspy is imported under TYPE_CHECKING, so mypy types `highspy` as the module; assigning the `_LazyModule` shim then trips [assignment] once highspy ships recognized types (highspy 1.13.1). Mirror the existing gurobipy line with `# type: ignore[assignment]`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
I canceled pypsa run to save ci minutes |
FabianHofmann
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mypy fix due to tightened stubs in highspy 1.15
Note
This change was generated by AI.
The direct-solve HiGHS path built the integrality array as
int32and passed it tochangeColsIntegrality, whosevar_typesargument expects auint8array — matching HiGHS's uint8-backedHighsVarTypeenum (Continuous=0, Integer=1, SemiContinuous=2, …).Recent highspy (1.13.1) tightened its type stubs to require
uint8here, which surfaces as a mypy error:The persistent in-place update path (
_apply_var_types) already builds this array asuint8; this aligns the direct-solve path.uint8is accepted at runtime across highspy versions, so this is a safe correctness fix, not a version workaround.