Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use myst-nb to demo ipywidgets double render bug #1765

Closed
wants to merge 1 commit into from

Conversation

gabalafou
Copy link
Collaborator

@gabalafou gabalafou commented Apr 11, 2024

This PR creates a demo of a bug (#1766). It is not meant to be merged in.

@gabalafou
Copy link
Collaborator Author

gabalafou commented Apr 11, 2024

You can see the bug at the following preview URL: https://pydata-sphinx-theme--1765.org.readthedocs.build/en/1765/examples/pydata.html#ipywidget

@gabalafou
Copy link
Collaborator Author

gabalafou commented Apr 11, 2024

Just noticed on that preview URL that ipyleaflet is also rendered twice

@choldgraf
Copy link
Collaborator

I wonder if it's because those libraries are calling a display function directly, and then we are doubling that output by calling display ourselves in the cell's code?

@12rambau
Copy link
Collaborator

I guess it is but the question is how Jupyter notebook itself prevent this behaviour ?

@gabalafou
Copy link
Collaborator Author

Also, why is there no doubling with nbsphinx?

@12rambau
Copy link
Collaborator

Is it also the case if you drop our theme and use the good old alabaster ? If it's the case then the issue is on myst-nb side.

@gabalafou
Copy link
Collaborator Author

I wonder if it's because those libraries are calling a display function directly, and then we are doubling that output by calling display ourselves in the cell's code?

Tested this hypothesis today by replacing the call to display() like so:

-    "display(widgets.VBox([title, tab]))"
+    "widgets.VBox([title, tab])"

The result was the same. The widget rendered twice.

@gabalafou
Copy link
Collaborator Author

gabalafou commented Mar 11, 2025

Is it also the case if you drop our theme and use the good old alabaster ? If it's the case then the issue is on myst-nb side.

Tested this today. If we use alabaster, we do NOT see the outputs double. So it seems the issue may be with our theme and not myst-nb.

alabaster + myst-nb minimal repro

@gabalafou
Copy link
Collaborator Author

Closing this PR because the description is out of date, plus some of the contents of the PR have already been merged to main (the ipywigets example).

@gabalafou gabalafou closed this Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants