Skip to content

Commit

Permalink
Made cvxopt optional (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmartin8 committed Feb 18, 2021
1 parent 50645a8 commit 627dc62
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
15 changes: 3 additions & 12 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pypfopt/discrete_allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def lp_portfolio(self, reinvest=False, verbose=False, solver="GLPK_MI"):

opt = cp.Problem(cp.Minimize(objective), constraints)

if solver not in cp.installed_solvers():
if solver is not None and solver not in cp.installed_solvers():
raise NameError("Solver {} is not installed. ".format(solver))
opt.solve(solver=solver)

Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ python = "^3.6.1"
numpy = "^1.12"
scipy = "^1.3"
pandas = ">=0.19"
cvxopt = "^1.2, !=1.2.5.post1"
cvxpy = "^1.1.10"
scikit-learn = {version="^0.24.1", optional= true }
matplotlib = { version = "^3.2.0", optional = true }
cvxopt = {version="^1.2, !=1.2.5.post1", optional=true }
scikit-learn = {version = "^0.24.1", optional=true }
matplotlib = { version = "^3.2.0", optional=true }

[tool.poetry.dev-dependencies]
pytest = "^4.6"
Expand All @@ -51,7 +51,7 @@ jedi = "0.17.2"
pytest-cov = "^2.11.1"

[tool.poetry.extras]
optionals = ["scikit-learn", "matplotlib"]
optionals = ["scikit-learn", "matplotlib", "cvxopt"]

[build-system]
requires = ["poetry>=0.12"]
Expand Down

0 comments on commit 627dc62

Please sign in to comment.