Skip to content

Commit

Permalink
Add startup validation for spyder-kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Jun 23, 2018
1 parent 391abde commit f1cafb5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
from spyder import requirements
requirements.check_path()
requirements.check_qt()
requirements.check_spyder_kernels()


#==============================================================================
Expand Down
23 changes: 20 additions & 3 deletions spyder/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def show_warning(message):
pass
raise RuntimeError(message)


def check_path():
"""Check sys.path: is Spyder properly installed?"""
dirname = osp.abspath(osp.join(osp.dirname(__file__), osp.pardir))
Expand All @@ -32,6 +33,7 @@ def check_path():
"or directory '%s' must be in PYTHONPATH "
"environment variable." % dirname)


def check_qt():
"""Check Qt binding requirements"""
qt_infos = dict(pyqt5=("PyQt5", "5.5"))
Expand All @@ -46,8 +48,23 @@ def check_qt():
except ImportError:
show_warning("Failed to import qtpy.\n"
"Please check Spyder installation requirements:\n\n"
"qtpy 1.1.0+ and either\n"
"%s %s+ or\n"
"qtpy 1.2.0+ and\n"
"%s %s+\n\n"
"are required to run Spyder."
% (qt_infos['pyqt5'] + qt_infos['pyqt']))
% (qt_infos['pyqt5']))


def check_spyder_kernels():
"""Check spyder-kernel requirement."""
try:
import spyder_kernels
required_ver = '1.0.0'
actual_ver = spyder_kernels.__version__
if LooseVersion(actual_ver) >= LooseVersion(required_ver):
show_warning("Please check Spyder installation requirements:\n"
"spyder-kernels < 1.0 is required (found %s)."
% actual_ver)
except ImportError:
show_warning("Failed to import spyder-kernels.\n"
"Please check Spyder installation requirements:\n\n"
"spyder-kernels < 1.0 is required")

0 comments on commit f1cafb5

Please sign in to comment.