##// END OF EJS Templates
Deprecate `IPython.utils.version`...
Nikita Kniazev -
Show More
@@ -31,7 +31,6 b' else:'
31 import os
31 import os
32 import sys
32 import sys
33
33
34 from IPython.utils.version import check_version
35 from IPython.external.qt_loaders import (
34 from IPython.external.qt_loaders import (
36 load_qt,
35 load_qt,
37 loaded_api,
36 loaded_api,
@@ -101,8 +100,8 b' def get_options():'
101
100
102 mpl = sys.modules.get('matplotlib', None)
101 mpl = sys.modules.get('matplotlib', None)
103
102
104 if mpl is not None and not check_version(mpl.__version__, '1.0.2'):
103 if mpl is not None and tuple(mpl.__version__.split(".")) < ("1", "0", "2"):
105 #1.0.1 only supports PyQt4 v1
104 # 1.0.1 only supports PyQt4 v1
106 return [QT_API_PYQT_DEFAULT]
105 return [QT_API_PYQT_DEFAULT]
107
106
108 qt_api = os.environ.get('QT_API', None)
107 qt_api = os.environ.get('QT_API', None)
@@ -13,8 +13,6 b' import types'
13 from functools import partial, lru_cache
13 from functools import partial, lru_cache
14 import operator
14 import operator
15
15
16 from IPython.utils.version import check_version
17
18 # ### Available APIs.
16 # ### Available APIs.
19 # Qt6
17 # Qt6
20 QT_API_PYQT6 = "pyqt6"
18 QT_API_PYQT6 = "pyqt6"
@@ -149,7 +147,8 b' def has_binding(api):'
149 if api == QT_API_PYSIDE:
147 if api == QT_API_PYSIDE:
150 # We can also safely check PySide version
148 # We can also safely check PySide version
151 import PySide
149 import PySide
152 return check_version(PySide.__version__, '1.0.3')
150
151 return PySide.__version_info__ >= (1, 0, 3)
153
152
154 return True
153 return True
155
154
@@ -211,7 +210,7 b' def import_pyqt4(version=2):'
211
210
212 from PyQt4 import QtGui, QtCore, QtSvg
211 from PyQt4 import QtGui, QtCore, QtSvg
213
212
214 if not check_version(QtCore.PYQT_VERSION_STR, '4.7'):
213 if QtCore.PYQT_VERSION < 0x040700:
215 raise ImportError("IPython requires PyQt4 >= 4.7, found %s" %
214 raise ImportError("IPython requires PyQt4 >= 4.7, found %s" %
216 QtCore.PYQT_VERSION_STR)
215 QtCore.PYQT_VERSION_STR)
217
216
@@ -12,15 +12,10 b' It is a bit ridiculous that we need these.'
12 # the file COPYING, distributed as part of this software.
12 # the file COPYING, distributed as part of this software.
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 #-----------------------------------------------------------------------------
15 from warnings import warn
16 # Imports
17 #-----------------------------------------------------------------------------
18
16
19 from distutils.version import LooseVersion
17 warn("The `IPython.utils.version` module has been deprecated since IPython 8.0.")
20
18
21 #-----------------------------------------------------------------------------
22 # Code
23 #-----------------------------------------------------------------------------
24
19
25 def check_version(v, check):
20 def check_version(v, check):
26 """check version string v >= check
21 """check version string v >= check
@@ -29,6 +24,15 b' def check_version(v, check):'
29 it is assumed that the dependency is satisfied.
24 it is assumed that the dependency is satisfied.
30 Users on dev branches are responsible for keeping their own packages up to date.
25 Users on dev branches are responsible for keeping their own packages up to date.
31 """
26 """
27 warn(
28 "`check_version` function is deprecated as of IPython 8.0"
29 "and will be removed in future versions.",
30 DeprecationWarning,
31 stacklevel=2,
32 )
33
34 from distutils.version import LooseVersion
35
32 try:
36 try:
33 return LooseVersion(v) >= LooseVersion(check)
37 return LooseVersion(v) >= LooseVersion(check)
34 except TypeError:
38 except TypeError:
@@ -43,5 +43,6 b' addopts = --durations=10'
43 --ignore=IPython/utils/log.py
43 --ignore=IPython/utils/log.py
44 --ignore=IPython/utils/signatures.py
44 --ignore=IPython/utils/signatures.py
45 --ignore=IPython/utils/traitlets.py
45 --ignore=IPython/utils/traitlets.py
46 --ignore=IPython/utils/version.py
46 doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS
47 doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS
47 ipdoctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS
48 ipdoctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS
General Comments 0
You need to be logged in to leave comments. Login now