From a3d514bccb32428a8ce02a6551efc31414ae5eb8 Mon Sep 17 00:00:00 2001 From: enzbus Date: Tue, 3 Sep 2024 17:44:06 +0100 Subject: [PATCH 1/3] Update simulator.py --- cvxportfolio/simulator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cvxportfolio/simulator.py b/cvxportfolio/simulator.py index f767e7e10..59e2b3360 100644 --- a/cvxportfolio/simulator.py +++ b/cvxportfolio/simulator.py @@ -50,7 +50,10 @@ import numpy as np import pandas as pd -from multiprocess import Lock, Pool # pylint: disable=no-name-in-module +try: # pragma: no cover + from multiprocess import Lock, Pool # pylint: disable=no-name-in-module +except ImportError: + from multiprocessing import Lock, Pool from .cache import _load_cache, _mp_init, _store_cache from .costs import StocksHoldingCost, StocksTransactionCost From a2d3b45a5018cbda5d93c2c21fe4778e057bd7cc Mon Sep 17 00:00:00 2001 From: enzbus Date: Tue, 3 Sep 2024 17:47:48 +0100 Subject: [PATCH 2/3] Update test_simulator.py --- cvxportfolio/tests/test_simulator.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cvxportfolio/tests/test_simulator.py b/cvxportfolio/tests/test_simulator.py index 6eac7d078..1d1556854 100644 --- a/cvxportfolio/tests/test_simulator.py +++ b/cvxportfolio/tests/test_simulator.py @@ -38,7 +38,10 @@ import copy import datetime -import multiprocessing +try: # pragma: no cover + from multiprocessing import cpu_count +except ImportError: + from multiprocess import cpu_count import re import time import unittest @@ -663,7 +666,7 @@ def test_multiple_backtest(self): # pylint: disable=too-many-locals def test_multiple_backtest2(self): """Test re-use of a worker process.""" - cpus = multiprocessing.cpu_count() + cpus = cpu_count() start = '2014-03-01' end = '2014-04-25' From 55e135f0c152a9e04d4a20a34f78632075578324 Mon Sep 17 00:00:00 2001 From: enzbus Date: Tue, 3 Sep 2024 17:49:42 +0100 Subject: [PATCH 3/3] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 05987fff0..3171fd9c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ dependencies = ["pandas", "numpy; python_version<'3.12'", "numpy<2.0.0; python_version>='3.12'", "matplotlib", "requests", "cvxpy", - "multiprocess", # robustifies usage w/ 3rd party modules + # "multiprocess", # robustifies usage w/ 3rd party modules, used if installed "scs" # it's hardcoded as fallback solver if numerical errors ]