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

Fix for compat for ipywidgets and ipynb #196

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bnouvelbmll
Copy link

We had issues with some serialised state from ipywidgets in notebook.

It was working fine when we using nbsphinx and old pinned dependencies - however when updating to latest sphinx and packages an exception was raised here. It seems it was excepted but that the wrong exception was caught - and that the exact type of exception to capture depends on other dependencies. I believe this change should be reasonable.

@bnouvelbmll
Copy link
Author

Obviously, I don't know what motivate the comment just below, and we would need to remove this comment if we go with the PR.

@akhmerov
Copy link
Member

This is unexpected: as far as I understand, if there are widgets in the notebook, the notebook must contain widget state. Do you have a minimal reproducible example? Can you write the notebook to disk around that point and share it?

@bnouvelbmll
Copy link
Author

bnouvelbmll commented Feb 10, 2022 via email

@bnouvelbmll
Copy link
Author

bnouvelbmll commented Feb 10, 2022 via email

@akhmerov
Copy link
Member

I agree that sphinx generally tends to not abort on data inconsistencies. Here, however, it is not clear to me how the error may occur and whether it isn't an actual bug. I believe that jupyter widgets must always write widget state whenever widgets are present. If that is correct, then this not happening would be an actual bug in the widget library and the way it communicates with the kernel, and shouldn't be treated like a user input problem. Basically something should create a widgets metadata entry in the notebook, but then not write widget state into this metadata.

I don't think the error message in the PR corresponds to the situation I described, and therefore wouldn't help debug what is happening. Can you share more information about the conditions under which the problem occurs?

@bnouvelbmll
Copy link
Author

bnouvelbmll commented Feb 14, 2022 via email

@akhmerov
Copy link
Member

This is weird: jupyter-sphinx does execution using nbclient, which doesn't have a javascript side and never talks with javascript. How are you using a notebook file wit jupyter-sphinx in the first place?

@bnouvelbmll
Copy link
Author

bnouvelbmll commented Feb 14, 2022 via email

@akhmerov
Copy link
Member

I believe the lower format was used in ipywidgets < 7.0.0, and so it is incompatible with jupyter-sphinx. Since jupyter-sphinx evaluates notebooks by itself, it seems that an installation that meets its requirements would never encounter a problem, or am I missing something?

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.

None yet

3 participants