Skip to content

Commit

Permalink
Merge pull request #37 from ssciwr/relax-ipywidgets-version-constraint
Browse files Browse the repository at this point in the history
Relax ipywidgets version constraint
  • Loading branch information
dokempf authored May 5, 2022
2 parents 17b48d6 + d5fac39 commit 9a82cd9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ipywidgets_jsonschema/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from ipywidgets_jsonschema.form import Form

__version__ = "0.7.3"
__version__ = "0.8.0"
17 changes: 14 additions & 3 deletions ipywidgets_jsonschema/form.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from IPython.display import display
from packaging import version

import collections
import ipywidgets
Expand All @@ -9,6 +10,10 @@
import traitlets


# We are providing some compatibility for ipywidgets v7 and v8
IS_VERSION_8 = version.parse(ipywidgets.__version__) >= version.parse("8")


class FormError(Exception):
pass

Expand Down Expand Up @@ -196,9 +201,15 @@ def _wrap_accordion(self, widget_list, schema, label=None):
titles = []
if label is not None or "title" in schema:
titles = [schema.get("title", label)]
accordion = ipywidgets.Accordion(
children=[ipywidgets.VBox(widget_list)], titles=titles
)

if IS_VERSION_8:
accordion = ipywidgets.Accordion(
children=[ipywidgets.VBox(widget_list)], titles=titles
)
else:
accordion = ipywidgets.Accordion(children=[ipywidgets.VBox(widget_list)])
for i, title in enumerate(titles):
accordion.set_title(i, title)

# This folds the accordion
accordion.selected_index = None
Expand Down
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ classifiers =
packages = find:
install_requires =
IPython
ipywidgets>=8.0.0b1
jsonschema==3.2.0
ipywidgets
jsonschema<4
packaging
traitlets

0 comments on commit 9a82cd9

Please sign in to comment.