You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 in PATH and it needs to be platform specific. We might need to run {sys.executable} -m jupyter nbconvert
The text was updated successfully, but these errors were encountered:
rebornix
added
bug
Issue identified by VS Code Team member as probable bug
and removed
bug
Issue identified by VS Code Team member as probable bug
labels
May 12, 2022
This is part of #9574
Currently the Export actions are powered by
nbconvert
. We will runnbconvert
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 nojupyter/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:${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 servernbconvert
through shell commands!jupyter nbconvert test.ipynb --to python --stdout
, but it has the same problem as the first approachstdin
:!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.jupyter
executable as it might exist inPATH
and it needs to be platform specific. We might need to run{sys.executable} -m jupyter nbconvert
The text was updated successfully, but these errors were encountered: