Gurobi / gurobipy-stubs

MIT License
10 stars 2 forks source link

Add stubs for gp.Env environment variables like ClientEnv, CloudEnv #12

Closed valentincalomme closed 1 year ago

valentincalomme commented 1 year ago

In my project, mypy was complaining at the following code:

import gurobipy as gp

env = gp.Env.ClientEnv(
        logfilename="", computeServer="my_gurobi_server", password="my_password"
    )

Raising the following error: "Type[Env]" has no attribute "ClientEnv" [attr-defined]mypy(error)

And when investigating, I realized that the stubs for Env indeed do not include any attributes, only methods. It would be nice to modify the stubs to avoid needing to use type:ignore

simonbowly commented 1 year ago

gp.Env.ClientEnv and gp.Env.CloudEnv were deprecated in Gurobi 9.5, and removed in Gurobi 10.0. You should instead use gp.Env(params=) to set compute server or instant cloud connection parameters as specified in the documentation.