Gurobi / gurobipy-stubs

MIT License
10 stars 2 forks source link

Postfix releases to prevent installation on gurobi > 10 #14

Closed simonbowly closed 9 months ago

simonbowly commented 1 year ago

Not sure what the usual practice is here. Installing the stubs will overwrite the type hints included with future gurobipy installs so we should try to prevent installing the stubs or at least warn the user.

gurobipy dependency version of the current packages on PyPI:

rluce commented 12 months ago

I think we should just put out a postfix release that pins gurobipy to 9.5.*. Users investigating what is going on will end up automatically at the project description, or come here to GH, to see the information.

simonbowly commented 12 months ago

Unfortunately, this doesn't work. If we push a postfix release for 1.0.1 which pins to 9.5.x, pip will just ignore it and choose from the gurobipy-stubs versions compatible with the installed gurobipy version. i.e. users of gurobipy 11 will get gurobipy-stubs 1.0.1 if they blindly install it (since 2.0.0 and 1.0.1.post0 will be incompatible with v11) and they won't get any warning.

So in addition to the postfix, we need to yank all wheels currently on pypi except 2.0.0. This will fail the install for anything other than an explicit gurobipy-stubs==1.0.1 requirement.

simonbowly commented 12 months ago

Postfix can be built from the v10 branch

rluce commented 12 months ago

Alright, thanks for investigating, it looks like we have a plan.

simonbowly commented 9 months ago

All seems to be behaving as expected (see below) so I'll close this issue.

> python --version
Python 3.9.18

> python -m pip install gurobipy-stubs gurobipy==9.5.*
Successfully installed gurobipy-9.5.2 gurobipy-stubs-1.0.1.post0

> python -m pip install gurobipy-stubs gurobipy==10.0.3
Successfully installed gurobipy-10.0.3 gurobipy-stubs-2.0.0

> python -m pip install gurobipy-stubs gurobipy==11.0.*
ERROR: Cannot install gurobipy-stubs==1.0.1.post0, gurobipy-stubs==2.0.0 and gurobipy==11.0.* because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested gurobipy==11.0.*
    gurobipy-stubs 2.0.0 depends on gurobipy==10.*
    The user requested gurobipy==11.0.*
    gurobipy-stubs 1.0.1.post0 depends on gurobipy==9.5.*

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts