diff --git a/CHANGELOG.md b/CHANGELOG.md index a6361497..1f3be024 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Updates * Add official support for Python 3.10 and 3.11 +### Bug Fixes +* Support `ipywidgets==8.0.0` + ## 0.20.1 ### Bug Fixes diff --git a/autovizwidget/autovizwidget/tests/test_encodingwidget.py b/autovizwidget/autovizwidget/tests/test_encodingwidget.py index 4a485c0b..1d4c59c2 100644 --- a/autovizwidget/autovizwidget/tests/test_encodingwidget.py +++ b/autovizwidget/autovizwidget/tests/test_encodingwidget.py @@ -59,12 +59,12 @@ def test_encoding_with_all_none_doesnt_throw(): call( description="X", value=None, - options={ - "date": "date", - "temp_diff": "temp_diff", - "-": None, - "buildingID": "buildingID", - }, + options=[ + ("-", None), + ("buildingID", "buildingID"), + ("date", "date"), + ("temp_diff", "temp_diff"), + ], ) in ipywidget_factory.get_dropdown.mock_calls ) @@ -72,12 +72,12 @@ def test_encoding_with_all_none_doesnt_throw(): call( description="Y", value=None, - options={ - "date": "date", - "temp_diff": "temp_diff", - "-": None, - "buildingID": "buildingID", - }, + options=[ + ("-", None), + ("buildingID", "buildingID"), + ("date", "date"), + ("temp_diff", "temp_diff"), + ], ) in ipywidget_factory.get_dropdown.mock_calls ) @@ -85,14 +85,14 @@ def test_encoding_with_all_none_doesnt_throw(): call( description="Func.", value="none", - options={ - "Max": "Max", - "Sum": "Sum", - "Avg": "Avg", - "-": "None", - "Min": "Min", - "Count": "Count", - }, + options=[ + ("-", "None"), + ("Avg", "Avg"), + ("Min", "Min"), + ("Max", "Max"), + ("Sum", "Sum"), + ("Count", "Count"), + ], ) in ipywidget_factory.get_dropdown.mock_calls ) diff --git a/autovizwidget/autovizwidget/widget/encodingwidget.py b/autovizwidget/autovizwidget/widget/encodingwidget.py index 38bb0af6..6fecd95d 100644 --- a/autovizwidget/autovizwidget/widget/encodingwidget.py +++ b/autovizwidget/autovizwidget/widget/encodingwidget.py @@ -43,8 +43,8 @@ def __init__( ) # X view - options_x_view = {text(i): text(i) for i in self.df.columns} - options_x_view["-"] = None + options_x_view = [(text(i), text(i)) for i in self.df.columns] + options_x_view.insert(0, ("-", None)) self.x_view = self.ipywidget_factory.get_dropdown( options=options_x_view, description="X", value=self.encoding.x ) @@ -52,8 +52,8 @@ def __init__( self.x_view.layout.width = "200px" # Y - options_y_view = {text(i): text(i) for i in self.df.columns} - options_y_view["-"] = None + options_y_view = [(text(i), text(i)) for i in self.df.columns] + options_y_view.insert(0, ("-", None)) y_column_view = self.ipywidget_factory.get_dropdown( options=options_y_view, description="Y", value=self.encoding.y ) @@ -62,15 +62,16 @@ def __init__( # Y aggregator value_for_view = self._get_value_for_aggregation(self.encoding.y_aggregation) + options_y_agg_view = [ + ("-", Encoding.y_agg_none), + (Encoding.y_agg_avg, Encoding.y_agg_avg), + (Encoding.y_agg_min, Encoding.y_agg_min), + (Encoding.y_agg_max, Encoding.y_agg_max), + (Encoding.y_agg_sum, Encoding.y_agg_sum), + (Encoding.y_agg_count, Encoding.y_agg_count), + ] self.y_agg_view = self.ipywidget_factory.get_dropdown( - options={ - "-": Encoding.y_agg_none, - Encoding.y_agg_avg: Encoding.y_agg_avg, - Encoding.y_agg_min: Encoding.y_agg_min, - Encoding.y_agg_max: Encoding.y_agg_max, - Encoding.y_agg_sum: Encoding.y_agg_sum, - Encoding.y_agg_count: Encoding.y_agg_count, - }, + options=options_y_agg_view, description="Func.", value=value_for_view, ) diff --git a/sparkmagic/sparkmagic/controllerwidget/addendpointwidget.py b/sparkmagic/sparkmagic/controllerwidget/addendpointwidget.py index c795c80a..471cdb8e 100644 --- a/sparkmagic/sparkmagic/controllerwidget/addendpointwidget.py +++ b/sparkmagic/sparkmagic/controllerwidget/addendpointwidget.py @@ -33,8 +33,9 @@ def __init__( auth_class = getattr(events_handler_module, class_name) self.auth_instances[auth] = auth_class() + dropdown_options = [(k, v) for k, v in conf.authenticators().items()] self.auth_type = self.ipywidget_factory.get_dropdown( - options=conf.authenticators(), description="Auth type:" + options=dropdown_options, description="Auth type:" ) # combine all authentication instance's widgets into one list to pass to self.children. @@ -89,9 +90,8 @@ def run(self): raise def _update_auth(self): - """ - Create an instance of the chosen auth type maps to in the config file. - """ + """Create an instance of the chosen auth type maps to in the config + file.""" for widget in self.auth.widgets: widget.layout.display = "none" self.auth = self.auth_instances.get(self.auth_type.value) diff --git a/sparkmagic/sparkmagic/controllerwidget/magicscontrollerwidget.py b/sparkmagic/sparkmagic/controllerwidget/magicscontrollerwidget.py index 9e990ce5..c4b2f667 100644 --- a/sparkmagic/sparkmagic/controllerwidget/magicscontrollerwidget.py +++ b/sparkmagic/sparkmagic/controllerwidget/magicscontrollerwidget.py @@ -61,8 +61,9 @@ def _get_default_endpoints(): return default_endpoints def _refresh(self): + dropdown_options = [(k, v) for k, v in self.endpoints.items()] self.endpoints_dropdown_widget = self.ipywidget_factory.get_dropdown( - description="Endpoint:", options=self.endpoints + description="Endpoint:", options=dropdown_options ) self.manage_session = ManageSessionWidget(