holoviews icon indicating copy to clipboard operation
holoviews copied to clipboard

.opts / .options warning raised when no options are set

Open maximlt opened this issue 1 year ago • 1 comments

When calling .opts on an element without passing any options a warning is emitted.

import holoviews as hv
hv.extension('bokeh')

hv.Scatter([0]).opts()
WARNING:param.main: Calling the .opts method with options broken down by options group (i.e. separate plot, style and norm groups) is deprecated. Use the .options method converting to the simplified format instead or use hv.opts.apply_groups for backward compatibility.

Users are unlikely to write that directly, but libraries like GeoViews use that in various places, for example: https://github.com/holoviz/geoviews/blob/master/geoviews/element/geo.py#L149-L150

maximlt avatar Aug 25 '22 10:08 maximlt

Maybe it's just a matter of removing this condition: https://github.com/holoviz/holoviews/blob/master/holoviews/core/util.py#L248-L249

maximlt avatar Aug 25 '22 10:08 maximlt

I can't tell what that used to point to, but I do think there should be an easy check that would fix this, and it's important to avoid those false alarms.

jbednar avatar Oct 22 '22 02:10 jbednar

I noticed that an empty opts will reset previous options, this should not be the case in my opinion.

image

hoxbro avatar Oct 27 '22 13:10 hoxbro

As .opts.clear() exists already, the easiest thing is to do nothing when you have an empty.opts (so it is a no-op, without the warning).

jlstevens avatar Oct 27 '22 13:10 jlstevens