Skip to content

Commit 4f60a87

Browse files
committed
[BUG] StarmapParallelization class moved to other subpackage #763
1 parent b65b718 commit 4f60a87

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

pymoo/core/problem.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,3 +371,26 @@ def default_shape(problem, n):
371371
dH=(n, problem.n_eq_constr, n_var),
372372
)
373373
return DEFAULTS
374+
375+
376+
# ===========================================================================
377+
# Backward compatibility for moved parallelization classes
378+
# ===========================================================================
379+
380+
def __getattr__(name):
381+
"""
382+
Provide backward compatibility for StarmapParallelization import.
383+
This class was moved from pymoo.core.problem to pymoo.parallelization.
384+
"""
385+
if name == 'StarmapParallelization':
386+
import warnings
387+
warnings.warn(
388+
"Importing 'StarmapParallelization' from 'pymoo.core.problem' is deprecated. "
389+
"Please use 'from pymoo.parallelization import StarmapParallelization' instead. "
390+
"This backward compatibility import will be removed in a future version.",
391+
DeprecationWarning,
392+
stacklevel=2
393+
)
394+
from pymoo.parallelization import StarmapParallelization
395+
return StarmapParallelization
396+
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")

0 commit comments

Comments
 (0)