Skip to content

_repr_json_ favored over widget output in notebooks with ipywidgets v8.0.1 #3576

Closed
@lukasbindreiter

Description

@lukasbindreiter

Description

I noticed that with a recent upgrade to ipywidgets==8.0.1 the behaviour of widgets that also have a _repr_json_ method changed.

Reproduce

import ipywidgets

class MyFloatProgress(ipywidgets.FloatProgress):
    def _repr_json_(self):
        return {"value": self.value}

MyFloatProgress(30)

image

Expected behavior

image

Context

This may seem like a pretty niche issue, but it is actually the underlying cause why tqdm.notebook doesn't work anymore currently with ipywidgets==8.0.1:

See:
tqdm/tqdm#1359

image

If using JupyterLab

  • JupyterLab version:
    3.4.5
Installed Labextensions
JupyterLab v3.4.5
/home/grasp/.venv/share/jupyter/labextensions
        dask-labextension v5.3.0 enabled OK (python, dask_labextension)
        jupyter-matplotlib v0.11.2 enabled OK
        jupyterlab-link-share v0.2.4 enabled OK (python, jupyterlab-link-share)
        jupyterlab-system-monitor v0.8.0 enabled OK (python, jupyterlab-system-monitor)
        jupyterlab-topbar-extension v0.6.1 enabled OK (python, jupyterlab-topbar)
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        @hadim/jupyter-archive v3.3.1 enabled OK (python, jupyter-archive)
        @jupyter-server/resource-usage v0.6.1 enabled OK (python, jupyter-resource-usage)
        @jupyter-widgets/jupyterlab-manager v5.0.2 enabled OK (python, jupyterlab_widgets)
        @jupyterlab/server-proxy v3.2.1 enabled OK
        @ryantam626/jupyterlab_code_formatter v1.5.3 enabled OK (python, jupyterlab-code-formatter)

Other labextensions (built into JupyterLab)
app dir: /home/grasp/.venv/share/jupyter/lab
@jupyterlab/geojson-extension v3.1.2 enabled OK
@jupyterlab/katex-extension v3.2.2 enabled OK
@jupyterlab/vega3-extension v3.1.3 enabled OK

Disabled extensions:
@jupyterlab/mathjax2-extension:plugin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions