-
Notifications
You must be signed in to change notification settings - Fork 557
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
save widgets after execute #779
Conversation
Currently default values are not removed and binary buffers are not saved. (updated to conform to widget state schema)
Looking into fixing on Python 2.7... |
@jasongrout So is this your preferred mechanism for having widgets in exported contexts? Rather than with the custom mimetype and using the cdn approach? |
nbconvert/preprocessors/execute.py
Outdated
|
||
try: | ||
nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources) | ||
finally: | ||
self.kc.stop_channels() | ||
self.km.shutdown_kernel(now=self.shutdown_kernel == 'immediate') | ||
if self.widget_state: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you isolate this functionality in a separate method?
setup.py
Outdated
@@ -199,7 +199,7 @@ def run(self): | |||
] | |||
|
|||
extra_requirements = { | |||
'test': ['pytest', 'pytest-cov', 'ipykernel', 'jupyter_client>=4.2'], | |||
'test': ['pytest', 'pytest-cov', 'ipykernel', 'jupyter_client>=4.2', 'ipywidgets'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be a specific version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably be at least >=7
|
||
wdata = output_nb['metadata']['widgets'] \ | ||
['application/vnd.jupyter.widget-state+json'] | ||
for k in model_ids: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice tests!
] | ||
} | ||
], | ||
"metadata": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the widget state for the widget view above?
I glanced through it, and it looks all right for storing widget state in a notebook. For a notebook, the widget views are stored as custom mimetypes, and the widget state is stored in the notebook metadata. The cdn is used by an html output, for example, to actually get the js code to render the widget views. |
ipywidgets min version changed to 7
@mpacer @jasongrout should be ready to go. |
@jasongrout, I'm about to cut 5.4, is this okay in your mind? |
This needs a rebase, thanks for tackling it @scottdraves! |
I believe this is now completed via #900 -- please reopen and rebase if you think there's anything that got missed. |
finished @ricklupton's PR