Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
Change ipywidgets version check to use __version__. Fixes #1571. (#1573)
Browse files Browse the repository at this point in the history
* Change ipywidgets version check to use __version__ instead of version_info. Fixes Issue #1571.

* Update CI images.

* Improve version handling (thanks @apayne97).
  • Loading branch information
clonker authored Sep 7, 2022
1 parent 00df5db commit 872d18e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
8 changes: 4 additions & 4 deletions devtools/azure-pipelines-linux.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
jobs:
- job: 'Linux'
pool:
vmImage: 'Ubuntu-18.04'
vmImage: 'ubuntu-22.04'
timeoutInMinutes: 360

strategy:
matrix:
Python37:
CONDA_PY: '3.7'
CONDA_NPY: '1.18'
Python38:
CONDA_PY: '3.8'
CONDA_NPY: '1.18'
Python39:
CONDA_PY: '3.9'
CONDA_NPY: '1.19'
Python310:
CONDA_PY: '3.10'
CONDA_NPY: '1.21'

maxParallel: 10

Expand Down
8 changes: 4 additions & 4 deletions devtools/azure-pipelines-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ jobs:
- job:
displayName: "OS X"
pool:
vmImage: 'macOS-10.15'
vmImage: 'macOS-11'
strategy:
matrix:
Python37:
CONDA_PY: '3.7'
CONDA_NPY: '1.18'
Python38:
CONDA_PY: '3.8'
CONDA_NPY: '1.18'
Python39:
CONDA_PY: '3.9'
CONDA_NPY: '1.19'
Python310:
CONDA_PY: '3.10'
CONDA_NPY: '1.21'

steps:
- template: checkout.yml
Expand Down
6 changes: 3 additions & 3 deletions devtools/azure-pipelines-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ jobs:
vmImage: "windows-2019"
strategy:
matrix:
Python37:
CONDA_PY: '3.7'
CONDA_NPY: '1.18'
Python38:
CONDA_PY: '3.8'
CONDA_NPY: '1.18'
Python39:
CONDA_PY: '3.9'
CONDA_NPY: '1.19'
Python310:
CONDA_PY: '3.10'
CONDA_NPY: '1.21'

steps:
- template: checkout.yml
Expand Down
16 changes: 14 additions & 2 deletions pyemma/_base/progress/reporter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from numbers import Integral
from typing import Optional


def _simple_memorize(f):
Expand All @@ -12,12 +13,23 @@ def wrapper():
return wrapper


def _ipywidgets_major_version() -> Optional[int]:
r""" Determine ipywidgets major version if possible, otherwise return None. """
import ipywidgets
if hasattr(ipywidgets, '__version__'):
return int(ipywidgets.__version__.split('.')[0])
elif hasattr(ipywidgets, 'version_info'):
return ipywidgets.version_info[0]
else:
return None


@_simple_memorize
def _attached_to_ipy_notebook_with_widgets():
try:
# check for widgets
import ipywidgets
if ipywidgets.version_info[0] < 4:
version = _ipywidgets_major_version()
if version is None or version < 4:
raise ImportError()
# check for ipython kernel
from IPython import get_ipython
Expand Down

0 comments on commit 872d18e

Please sign in to comment.