finos / perspective

A data visualization and analytics component, especially well-suited for large and/or streaming datasets.
https://perspective.finos.org/
Apache License 2.0
7.73k stars 1.05k forks source link

Simple PerspectiveWidget errors restoring its own saved config #2464

Closed tomjakubowski closed 6 months ago

tomjakubowski commented 7 months ago

Bug Report

Steps to Reproduce:

  1. Create perspective-python notebook
  2. Add code snippet below to a cell
  3. Execute the cell
w = PerspectiveWidget(
    {"a": [1]}
)

config = w.save()

PerspectiveWidget(df, **config)

Expected Result:

Widget restores config

Actual Result:

Error is raised:

(open to see screenshot) Screenshot 2023-12-04 at 6 23 53 PM
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[17], line 7
      1 w = PerspectiveWidget(
      2     {"a": [1]}
      3 )
      5 config = w.save()
----> 7 PerspectiveWidget(df, **config)

File /opt/homebrew/Caskroom/miniconda/base/envs/perspective-jupyterlab/lib/python3.11/site-packages/perspective/widget/widget.py:289, in PerspectiveWidget.__init__(self, data, index, limit, server, client, **kwargs)
    286         kwargs.update({"columns": config["columns"]})
    288 # Initialize the viewer
--> 289 super(PerspectiveWidget, self).__init__(**kwargs)
    291 # Handle messages from the the front end
    292 # `PerspectiveJupyterClient.send()`:
    293 # - The "data" value of the message should be a JSON-serialized string.
    294 # - Both `on_msg` and `@observe("value")` must be specified on the
    295 # handler for custom messages to be parsed by the Python widget.
    296 self.on_msg(self.handle_message)

File /opt/homebrew/Caskroom/miniconda/base/envs/perspective-jupyterlab/lib/python3.11/site-packages/ipywidgets/widgets/widget.py:503, in Widget.__init__(self, **kwargs)
    501 """Public constructor"""
    502 self._model_id = kwargs.pop('model_id', None)
--> 503 super().__init__(**kwargs)
    505 Widget._call_widget_constructed(self)
    506 self.open()

TypeError: PerspectiveViewer.__init__() got an unexpected keyword argument 'version'

Environment:

perspective-python 2.7.1, python 3.11.5

Additional Context:

I imagine we need to either ignore the version in the config, or else use it, but I'm lacking context at the moment.