@@ -597,8 +597,12 @@ class VitesscePlugin:
597597 """
598598 A class that represents a Vitessce widget plugin. Custom plugins can be created by subclassing this class.
599599 """
600- plugin_esm = DEFAULT_PLUGIN_ESM
601- commands = {}
600+
601+ #: The ES module string for the plugin.
602+ plugin_esm = DEFAULT_PLUGIN_ESM # type: str
603+
604+ #: A dictionary mapping command name strings to functions. Functions should take two arguments (message, buffers) and return a tuple (response, buffers).
605+ commands = {} # type: dict
602606
603607 def on_config_change (self , new_config ):
604608 """
@@ -614,19 +618,29 @@ def on_config_change(self, new_config):
614618
615619class VitessceWidget (anywidget .AnyWidget ):
616620 """
617- A class to represent a Jupyter widget for Vitessce.
621+ A class to represent a Jupyter widget for Vitessce. Not intended to be instantiated directly; instead, use ``VitessceConfig.widget``.
622+
623+ .. code-block:: python
624+ :emphasize-lines: 4
625+
626+ from vitessce import VitessceConfig
627+
628+ vc = VitessceConfig.from_object(my_scanpy_object)
629+ vw = vc.widget()
630+ vw
618631 """
619632 _esm = ESM
620633
621634 # Widget specific property.
622635 # Widget properties are defined as traitlets. Any property tagged with `sync=True`
623636 # is automatically synced to the frontend *any* time it changes in Python.
624637 # It is synced back to Python from the frontend *any* time the model is touched.
625- _config = Dict ({}).tag (sync = True )
626- """dict: Dictionary representation of the Vitessce JSON configuration. Synced via traitlets upon interactions."""
638+
639+ #: Dictionary representation of the Vitessce JSON configuration. Synced via traitlets upon interactions.
640+ _config = Dict ({}).tag (sync = True ) # type: dict
627641
628- config = None
629- """VitessceConfig: The VitessceConfig instance used to create this widget. Not synced upon interactions."""
642+ #: The VitessceConfig instance used to create this widget. Not synced upon interactions.
643+ config = None # type: vitessce.config.VitessceConfig
630644
631645 height = Int (600 ).tag (sync = True )
632646 theme = Unicode ('auto' ).tag (sync = True )
@@ -650,9 +664,10 @@ class VitessceWidget(anywidget.AnyWidget):
650664 store_urls = List (trait = Unicode ('' ), default_value = []).tag (sync = True )
651665
652666 def __init__ (self , config , height = 600 , theme = 'auto' , uid = None , port = None , proxy = False , js_package_version = '3.6.12' , js_dev_mode = False , custom_js_url = '' , plugins = None , remount_on_uid_change = True , prefer_local = True , invoke_timeout = 300000 , invoke_batched = True , page_mode = False , page_esm = None , prevent_scroll = True ):
667+ """ """
653668 """
654- Construct a new Vitessce widget.
655-
669+ Construct a new Vitessce widget. Not intended to be instantiated directly; instead, use ``VitessceConfig.widget``.
670+
656671 :param config: A view config instance.
657672 :type config: VitessceConfig
658673 :param str theme: The theme name, either "light" or "dark". By default, "auto", which selects light or dark based on operating system preferences.
@@ -671,14 +686,7 @@ def __init__(self, config, height=600, theme='auto', uid=None, port=None, proxy=
671686 :param str page_esm: The ES module string for the page component creation function. Optional.
672687 :param bool prevent_scroll: Should mouseover in the Vitessce widget prevent disable the scrolling of the notebook? By default, True.
673688
674- .. code-block:: python
675- :emphasize-lines: 4
676-
677- from vitessce import VitessceConfig, VitessceWidget
678-
679- vc = VitessceConfig.from_object(my_scanpy_object)
680- vw = vc.widget()
681- vw
689+ Note: these parameter docstrings need to be manually kept in sync with the VitessceConfig.widget docstring.
682690 """
683691
684692 base_url , use_port , VitessceWidget .next_port = get_base_url_and_port (
@@ -817,7 +825,7 @@ def ipython_display(config, height=600, theme='auto', base_url=None, host_name=N
817825 "has_host_name" : host_name is not None ,
818826 "height" : height ,
819827 "theme" : theme ,
820- "config " : config_dict ,
828+ "_config " : config_dict ,
821829 "store_urls" : [],
822830 }
823831
0 commit comments