You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have confirmed this bug exists on the lastest release of Linopy.
I have confirmed this bug exists on the current master branch of Linopy.
Issue Description
Hi,
as far as I know Linopy supports type checking via mypy. However, when I add/multiply a linopy.Variable with a xarray.DataArray I get a Unsupported operand types for <...> ("Variable" and "DataArray") error from mypy.
Executing the code works as expected.
Tested with latest versions of all 3 packages: linopy-0.5.2mypy-1.15.0xarray-2025.3.0
Reproducible Example
importlinopyimportxarrayasxrm=linopy.Model()
a: xr.DataArray=xr.DataArray([1, 2, 3])
v: linopy.Variable=m.add_variables(lower=a, name="v")
# this gives# > error: Unsupported operand types for * ("Variable" and "DataArray") [operator]m.add_constraints(v*a*10.0<=0.0)
# > error: Unsupported operand types for + ("Variable" and "DataArray") [operator]m.add_constraints(v+a*10.0<=0.0)
Expected Behavior
No mypy error, as the code works as expected.
Installed Versions
linopy-0.5.2 mypy-1.15.0 xarray-2025.3.0
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Version Checks (indicate both or one)
I have confirmed this bug exists on the lastest release of Linopy.
I have confirmed this bug exists on the current
master
branch of Linopy.Issue Description
Hi,
as far as I know
Linopy
supports type checking viamypy
. However, when I add/multiply alinopy.Variable
with axarray.DataArray
I get aUnsupported operand types for <...> ("Variable" and "DataArray")
error from mypy.Executing the code works as expected.
Tested with latest versions of all 3 packages:
linopy-0.5.2
mypy-1.15.0
xarray-2025.3.0
Reproducible Example
Expected Behavior
No
mypy
error, as the code works as expected.Installed Versions
The text was updated successfully, but these errors were encountered: