Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cvxportfolio/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions cvxportfolio/tests/test_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you got this one backwards 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Yes and in fact on second read I think we can drop multiprocess from here.

import re
import time
import unittest
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
]

Expand Down