Skip to content

hv.help not helpful outside of Jupyter #6775

@MarcSkovMadsen

Description

@MarcSkovMadsen

I was trying to get the docstring including style options and plot options programmatically for usage with holoviz-mcp. I spend a long time before I realized that hv.help(hv.Curve) works very differently whether you are in a notebook or using plain python.

It seems the InfoPrinter is only configured and used in a notebook. Which makes hv.help work very differently.

Image

InfoPrinter.store = Store

Reproduce

When you run

import holoviews as hv

hv.extension("bokeh")

hv.help(hv.Curve)

You see

Image

Workaround: Set InfoPrinter.store manually

import holoviews as hv
from holoviews.core.pprint import InfoPrinter
from holoviews.core.options import Store

InfoPrinter.store = Store

hv.extension("bokeh")

hv.help(hv.Curve)
Image

Related issues

Wish

In the end the below code should just work for users no matter where they work.

import holoviews as hv

hv.help(hv.Curve, backend='matplotlib')

and

from holoviews.core.pprint import InfoPrinter

info = InfoPrinter.info(obj, ansi=False, backend="bokeh", visualization=True, pattern=None, elements=elements_list)
print(info)

Metadata

Metadata

Assignees

No one assigned

    Labels

    TRIAGENeeds triaging

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions