-
Notifications
You must be signed in to change notification settings - Fork 338
Closed
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionality
Description
This is part of #9574
Currently the Export actions are powered by nbconvert
. We will run nbconvert
in a separate process and save the converted content in a temporary file on disk. This is not feasible on Web as Jupyter runs in web worker and there is no jupyter/nbconvert
in the same environment. To archive the same thing on Web, we would need to ask the remote Jupyter server/service to handle the nbconvert request for us.
There are two ways to run nbconvert
on the remote Jupyter server:
- The first one is directly calling the nbconvert web service, we can construct an url as
${baseUrl}/nbconvert/${type}/${filePath}?token=${token}
and fetch this resource in the web extension. However it requires the file to be synced to the remote Jupyter server - The second one is calling
nbconvert
through shell commands- We can either run it against files, i.e.,
!jupyter nbconvert test.ipynb --to python --stdout
, but it has the same problem as the first approach - Or we can pass in the content through
stdin
:!echo '{"cells": [], "metadata": {}, "nbformat": 4, "nbformat_minor": 2 }' | jupyter nbconvert --nbformat 4 --stdin --to python --stdout
. This is the only approach that doesn't require file to be synced but if the file is large, it will affect the throughput. - The catch with running shell commands is it requires us to know the path of the active
jupyter
executable as it might exist inPATH
and it needs to be platform specific. We might need to run{sys.executable} -m jupyter nbconvert
- We can either run it against files, i.e.,
Metadata
Metadata
Assignees
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionality