Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.options(multi_y=True) can raise strange exceptions #6322

Open
1 task
douglas-raillard-arm opened this issue Jul 10, 2024 · 0 comments
Open
1 task

.options(multi_y=True) can raise strange exceptions #6322

douglas-raillard-arm opened this issue Jul 10, 2024 · 0 comments
Labels
type: bug Something isn't correct or isn't working
Milestone

Comments

@douglas-raillard-arm
Copy link
Contributor

ALL software version info

holoviews==1.19.1
bokeh==3.4.2
jupyterlab==4.2.3
firefox==127.0.2
python==3.12

Description of expected behavior and the observed behavior

This code should raise the following exception:

ValueError: Unexpected option 'multi_y' for Curve type across all extensions. Similar options for current extension ('bokeh') are: ['multi_y'].

Complete, minimal, self-contained example code that reproduces the issue

import holoviews as hv
hv.extension('bokeh')
hv.Curve([1,2]).options(multi_y=True)

Stack traceback and/or browser JavaScript console output

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File venv/lib/python3.12/site-packages/IPython/core/formatters.py:977, in MimeBundleFormatter.__call__(self, obj, include, exclude)
    974     method = get_real_method(obj, self.print_method)
    976     if method is not None:
--> 977         return method(include=include, exclude=exclude)
    978     return None
    979 else:

File venv/lib/python3.12/site-packages/holoviews/core/dimension.py:1275, in Dimensioned._repr_mimebundle_(self, include, exclude)
   1268 def _repr_mimebundle_(self, include=None, exclude=None):
   1269     """
   1270     Resolves the class hierarchy for the class rendering the
   1271     object using any display hooks registered on Store.display
   1272     hooks.  The output of all registered display_hooks is then
   1273     combined and returned.
   1274     """
-> 1275     return Store.render(self)

File venv/lib/python3.12/site-packages/holoviews/core/options.py:1428, in Store.render(cls, obj)
   1426 data, metadata = {}, {}
   1427 for hook in hooks:
-> 1428     ret = hook(obj)
   1429     if ret is None:
   1430         continue

File venv/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py:287, in pprint_display(obj)
    285 if not ip.display_formatter.formatters['text/plain'].pprint:
    286     return None
--> 287 return display(obj, raw_output=True)

File venv/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py:255, in display(obj, raw_output, **kwargs)
    253 elif isinstance(obj, (CompositeOverlay, ViewableElement)):
    254     with option_state(obj):
--> 255         output = element_display(obj)
    256 elif isinstance(obj, (Layout, NdLayout, AdjointLayout)):
    257     with option_state(obj):

File venv/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py:149, in display_hook.<locals>.wrapped(element)
    147 try:
    148     max_frames = OutputSettings.options['max_frames']
--> 149     mimebundle = fn(element, max_frames=max_frames)
    150     if mimebundle is None:
    151         return {}, {}

File venv/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py:195, in element_display(element, max_frames)
    192 if type(element) not in Store.registry[backend]:
    193     return None
--> 195 return render(element)

File venv/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py:76, in render(obj, **kwargs)
     73 if renderer.fig == 'pdf':
     74     renderer = renderer.instance(fig='png')
---> 76 return renderer.components(obj, **kwargs)

File venv/lib/python3.12/site-packages/holoviews/plotting/renderer.py:396, in Renderer.components(self, obj, fmt, comm, **kwargs)
    394 embed = (not (dynamic or streams or self.widget_mode == 'live') or config.embed)
    395 if embed or config.comms == 'default':
--> 396     return self._render_panel(plot, embed, comm)
    397 return self._render_ipywidget(plot)

File venv/lib/python3.12/site-packages/holoviews/plotting/renderer.py:403, in Renderer._render_panel(self, plot, embed, comm)
    401 doc = Document()
    402 with config.set(embed=embed):
--> 403     model = plot.layout._render_model(doc, comm)
    404 if embed:
    405     return render_model(model, comm)

File venv/lib/python3.12/site-packages/panel/viewable.py:735, in Viewable._render_model(self, doc, comm)
    733 if comm is None:
    734     comm = state._comm_manager.get_server_comm()
--> 735 model = self.get_root(doc, comm)
    737 if self._design and self._design.theme.bokeh_theme:
    738     doc.theme = self._design.theme.bokeh_theme

File venv/lib/python3.12/site-packages/panel/layout/base.py:319, in Panel.get_root(self, doc, comm, preprocess)
    315 def get_root(
    316     self, doc: Optional[Document] = None, comm: Optional[Comm] = None,
    317     preprocess: bool = True
    318 ) -> Model:
--> 319     root = super().get_root(doc, comm, preprocess)
    320     # ALERT: Find a better way to handle this
    321     if hasattr(root, 'styles') and 'overflow-x' in root.styles:

File venv/lib/python3.12/site-packages/panel/viewable.py:666, in Renderable.get_root(self, doc, comm, preprocess)
    664 wrapper = self._design._wrapper(self)
    665 if wrapper is self:
--> 666     root = self._get_model(doc, comm=comm)
    667     if preprocess:
    668         self._preprocess(root)

File venv/lib/python3.12/site-packages/panel/layout/base.py:185, in Panel._get_model(self, doc, root, parent, comm)
    183 root = root or model
    184 self._models[root.ref['id']] = (model, parent)
--> 185 objects, _ = self._get_objects(model, [], doc, root, comm)
    186 props = self._get_properties(doc)
    187 props[self._property_mapping['objects']] = objects

File venv/lib/python3.12/site-packages/panel/layout/base.py:167, in Panel._get_objects(self, model, old_objects, doc, root, comm)
    165 else:
    166     try:
--> 167         child = pane._get_model(doc, root, model, comm)
    168     except RerenderError as e:
    169         if e.layout is not None and e.layout is not self:

File venv/lib/python3.12/site-packages/panel/pane/holoviews.py:429, in HoloViews._get_model(self, doc, root, parent, comm)
    427     plot = self.object
    428 else:
--> 429     plot = self._render(doc, comm, root)
    431 plot.pane = self
    432 backend = plot.renderer.backend

File venv/lib/python3.12/site-packages/panel/pane/holoviews.py:525, in HoloViews._render(self, doc, comm, root)
    522     if comm:
    523         kwargs['comm'] = comm
--> 525 return renderer.get_plot(self.object, **kwargs)

File venv/lib/python3.12/site-packages/holoviews/plotting/bokeh/renderer.py:68, in BokehRenderer.get_plot(self_or_cls, obj, doc, renderer, **kwargs)
     61 @bothmethod
     62 def get_plot(self_or_cls, obj, doc=None, renderer=None, **kwargs):
     63     """
     64     Given a HoloViews Viewable return a corresponding plot instance.
     65     Allows supplying a document attach the plot to, useful when
     66     combining the bokeh model with another plot.
     67     """
---> 68     plot = super().get_plot(obj, doc, renderer, **kwargs)
     69     if plot.document is None:
     70         plot.document = Document() if self_or_cls.notebook_context else curdoc()

File venv/lib/python3.12/site-packages/holoviews/plotting/renderer.py:239, in Renderer.get_plot(self_or_cls, obj, doc, renderer, comm, **kwargs)
    236     defaults = [kd.default for kd in plot.dimensions]
    237     init_key = tuple(v if d is None else d for v, d in
    238                      zip(plot.keys[0], defaults))
--> 239     plot.update(init_key)
    240 else:
    241     plot = obj

File venv/lib/python3.12/site-packages/holoviews/plotting/plot.py:956, in DimensionedPlot.update(self, key)
    954 def update(self, key):
    955     if len(self) == 1 and key in (0, self.keys[0]) and not self.drawn:
--> 956         return self.initialize_plot()
    957     item = self.__getitem__(key)
    958     self.traverse(lambda x: setattr(x, '_updated', True))

File venv/lib/python3.12/site-packages/holoviews/plotting/bokeh/element.py:2109, in ElementPlot.initialize_plot(self, ranges, plot, plots, source)
   2107 # Initialize plot, source and glyph
   2108 if plot is None:
-> 2109     plot = self._init_plot(key, style_element, ranges=ranges, plots=plots)
   2110     self._populate_axis_handles(plot)
   2111 else:

File venv/lib/python3.12/site-packages/holoviews/plotting/bokeh/element.py:908, in ElementPlot._init_plot(self, key, element, plots, ranges)
    906     if not bokeh32:
    907         self.param.warning('Independent axis zooming for multi_y=True only supported for Bokeh >=3.2')
--> 908     yaxes, extra_axis_specs = self._create_extra_axes(plots, subplots, element, ranges)
    909     axis_specs['y'].update(extra_axis_specs)
    910 else:

File venv/lib/python3.12/site-packages/holoviews/plotting/bokeh/element.py:835, in ElementPlot._create_extra_axes(self, plots, subplots, element, ranges)
    833 ax_specs, yaxes, dimensions = {}, {}, {}
    834 subcoordinate_axes = 0
--> 835 for el, (sp_key, sp) in zip(element, self.subplots.items()):
    836     ax_dims = sp._get_axis_dims(el)[:2]
    837     if sp.invert_axes:

AttributeError: 'NoneType' object has no attribute 'items'

Screenshots or screencasts of the bug in action

  • I may be interested in making a pull request to address this
@philippjfr philippjfr added the type: bug Something isn't correct or isn't working label Jul 10, 2024
@philippjfr philippjfr added this to the 1.19.2 milestone Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

No branches or pull requests

2 participants