From 489fe5fd4813ae8cda33495104747af2b34e9911 Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Mon, 29 Jun 2026 10:47:05 +0200 Subject: [PATCH 1/2] fix(highs): pass uint8 integrality array to changeColsIntegrality 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) --- linopy/solvers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linopy/solvers.py b/linopy/solvers.py index 70ace0ce1..14e69e720 100644 --- a/linopy/solvers.py +++ b/linopy/solvers.py @@ -1656,7 +1656,7 @@ def _build_solver_model( int_mask = (vtypes == "B") | (vtypes == "I") | (vtypes == "S") labels = np.arange(len(vtypes))[int_mask] integrality = np.array( - [integrality_map[v] for v in vtypes[int_mask]], dtype=np.int32 + [integrality_map[v] for v in vtypes[int_mask]], dtype=np.uint8 ) h.changeColsIntegrality(len(labels), labels, integrality) From d4dcafe408023a9e7174c8bb5571cb12c389a3d1 Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Mon, 29 Jun 2026 10:53:40 +0200 Subject: [PATCH 2/2] fix(highs): silence assignment error on highspy lazy module 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) --- linopy/solvers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linopy/solvers.py b/linopy/solvers.py index 14e69e720..987c7b70c 100644 --- a/linopy/solvers.py +++ b/linopy/solvers.py @@ -294,7 +294,7 @@ def __getattr__(self, attr: str) -> Any: gurobipy = _LazyModule("gurobipy") # type: ignore[assignment] -highspy = _LazyModule("highspy") +highspy = _LazyModule("highspy") # type: ignore[assignment] scip = _LazyModule("pyscipopt") cplex = _LazyModule("cplex") knitro = _LazyModule("knitro")