Skip to content

jupyter

Functionality to make widgets and dashboard work stand-alone in Jupyter.

Previewable

Bases: ObjectProxy

Wrapper to be used around MetadorContainer inside Jupyter.

Will ensure that widgets can work in the notebook.

Source code in src/metador_core/widget/jupyter/__init__.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class Previewable(wrapt.ObjectProxy):
    """Wrapper to be used around MetadorContainer inside Jupyter.

    Will ensure that widgets can work in the notebook.
    """

    def __init__(self, container: MetadorContainer):
        super().__init__(container)

        if not standalone.running():
            standalone.run()

        if provider := standalone.container_provider():
            provider[str(self.metador.container_uuid)] = self

    def close(self, *args, **kwargs):
        if provider := standalone.container_provider():
            del provider[str(self.metador.container_uuid)]

        self.__wrapped__.close(*args, **kwargs)