Skip to content

Commit bd238e0

Browse files
committed
Improve deprecation warnings and docstrings for MOSEK env parameter
1 parent 1eb602a commit bd238e0

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

linopy/solvers.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,8 @@ def solve_problem_from_model(
16611661
basis_fn : Path, optional
16621662
Path to the basis file.
16631663
env : None, optional, deprecated
1664-
Ignored.
1664+
Deprecated. This parameter is ignored. MOSEK now uses the global
1665+
environment automatically. Will be removed in a future version.
16651666
explicit_coordinate_names : bool, optional
16661667
Transfer variable and constraint names to the solver (default: False)
16671668
@@ -1672,7 +1673,11 @@ def solve_problem_from_model(
16721673

16731674
if env is not None:
16741675
warnings.warn(
1675-
"Argument 'env' in solve_problem_from_model", DeprecationWarning
1676+
"The 'env' parameter in solve_problem_from_model is deprecated and will be "
1677+
"removed in a future version. MOSEK now uses the global environment "
1678+
"automatically, avoiding unnecessary license checkouts.",
1679+
DeprecationWarning,
1680+
stacklevel=2,
16761681
)
16771682
with mosek.Task() as m:
16781683
m = model.to_mosek(m, explicit_coordinate_names=explicit_coordinate_names)
@@ -1712,16 +1717,21 @@ def solve_problem_from_file(
17121717
Path to the warmstart file.
17131718
basis_fn : Path, optional
17141719
Path to the basis file.
1715-
env : None, optional, deprecated.
1716-
Ignored.
1720+
env : None, optional, deprecated
1721+
Deprecated. This parameter is ignored. MOSEK now uses the global
1722+
environment automatically. Will be removed in a future version.
17171723
17181724
Returns
17191725
-------
17201726
Result
17211727
"""
17221728
if env is not None:
17231729
warnings.warn(
1724-
"Argument 'env' in solve_problem_from_model", DeprecationWarning
1730+
"The 'env' parameter in solve_problem_from_file is deprecated and will be "
1731+
"removed in a future version. MOSEK now uses the global environment "
1732+
"automatically, avoiding unnecessary license checkouts.",
1733+
DeprecationWarning,
1734+
stacklevel=2,
17251735
)
17261736
with mosek.Task() as m:
17271737
# read sense and io_api from problem file

0 commit comments

Comments
 (0)