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
8.3k stars 1.16k forks source link

Remove required dependency on ipywidgets, defer import of ipywidgets/PerspectiveWidget #2728

Closed timkpaine closed 1 minute ago

timkpaine commented 3 weeks ago

Ideally we shouldn't really need a top level dependency on ipywidgets:

https://github.com/finos/perspective/blob/768ca4068c79a2c2243aa24fd3a073f09c6dc97d/rust/perspective-python/pyproject.toml#L36

Perhaps we should move the import out of the top level __init__.py, forcing users to use perspective.widget.PerspectiveWidget, but saving on import time and also potentially a dependency.

tomjakubowski commented 1 week ago

I did some work towards this when adding pytest-pyodide tests for our emscripten wheel. My approach adds try/except around the top-level re-exports of the widget and viewer modules

timkpaine commented 1 week ago

This allows for it to be missing but still incurs an import cost if it is present but unused. That may not be worth resolving if these are very light imports

texodus commented 1 minute ago

Fixed in #2754, released in v3.1.0