MaayanLab / clustergrammer-widget

The Clustergrammer interactive Jupyter notebook widget
http://nbviewer.jupyter.org/github/MaayanLab/clustergrammer-widget/blob/master/Running_clustergrammer_widget.ipynb
MIT License
47 stars 27 forks source link

AttributeError at ipywidget bump >= 7.0 #17

Open antoinegaston opened 2 years ago

antoinegaston commented 2 years ago

Describe the bug This bug appears on bumping ipywidgets to 7.0 or higer. The full trace is:

tests/services/test_compute_rule.py:13: in <module>
    from ..app import RootTest, TestingDBSessionLocal
tests/app.py:11: in <module>
    from run import app
run.py:5: in <module>
    from src.app.controllers import private_router, public_router
src/app/controllers/__init__.py:22: in <module>
    from .indication_prioritization import router as indication_prioritization_router
src/app/controllers/indication_prioritization.py:25: in <module>
    from ..utils.indication_prioritization import (
src/app/utils/indication_prioritization.py:8: in <module>
    from clustergrammer_widget import Network, clustergrammer_widget
.venv/lib/python3.7/site-packages/clustergrammer_widget/__init__.py:3: in <module>
    from .example import *
.venv/lib/python3.7/site-packages/clustergrammer_widget/example.py:10: in <module>
    @widgets.register('hello.Hello')
.venv/lib/python3.7/site-packages/ipywidgets/widgets/widget.py:264: in register
    w = widget.class_traits()
AttributeError: 'str' object has no attribute 'class_traits'

It is linked to a deprecation of the name parameter of register method of the WidgetRegistry object from ipywidgets. A simple fix would be to replace @widgets.register('hello.Hello') by @widgets.register in clustergrammer_widget/example.py:10.

To Reproduce Steps to reproduce the behavior:

  1. Bump pytz to 7.0 or higher
  2. Import clustergrammer_widget from clustergrammer_widget in a dummy script
  3. Run it

Expected behavior No errors.

Desktop (please complete the following information):

cornhundred commented 2 years ago

Thanks @antoinegaston I'll look into releasing an update. You can also try the WebGL version of the Clustergrammer widget called https://github.com/ismms-himc/clustergrammer2

antoinegaston commented 2 years ago

Thank you @cornhundred for the fast answer, I already switched to clustergrammer2 and it seems to fix the issue.