Skip to content

Commit

Permalink
Make IPython optional
Browse files Browse the repository at this point in the history
Closes #5
  • Loading branch information
stephane-caron committed Nov 2, 2022
1 parent 7a903f2 commit 9f466f6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import argparse
import os

import IPython

from qpsolvers_benchmark import Report, Results, SolverSettings
from qpsolvers_benchmark.spdlog import logging
from qpsolvers_benchmark.test_sets import MarosMeszaros, MarosMeszarosDense
Expand Down Expand Up @@ -119,8 +117,15 @@ def parse_command_line_arguments():
if args.command == "eval":
df = results.df
logging.info("Check out `results` and the pandas DataFrame `df`")
if not IPython.get_ipython():
IPython.embed()
try:
import IPython

if not IPython.get_ipython():
IPython.embed()
except ImportError:
logging.error(
"IPython not found, assuming we are in interactive mode"
)

if args.command in ["report", "run"]:
report = Report(test_set, solver_settings, results)
Expand Down

0 comments on commit 9f466f6

Please sign in to comment.