JuliaGizmos / WebIO.jl

A bridge between Julia and the Web.
https://juliagizmos.github.io/WebIO.jl/latest/
Other
228 stars 64 forks source link

install_jupyter_labextension should be more clear about the commands it is running #444

Closed jlumpe closed 3 years ago

jlumpe commented 3 years ago

The bug

Specifically, the first two commands $jupyter labextension unlink --no-build @webio/webio and $jupyter labextension uninstall --no-build @webio/jupyter-lab-provider are meant to remove previous versions of the package/extension if they are currently installed, and are expected to fail if they do not. The issue is that when they fail as expected jupyter labextension still prints an error message to stdout, which can be very confusing if you don't know what's going on.

Example output when running in the standard Julia REPL (not IJulia) with no extensions previously installed:

julia> WebIO.install_jupyter_labextension(`/home/jared/opt/anaconda3/envs/jupyterlab2/bin/jupyter`)
An error occured.
ValueError: No linked package for @webio/webio
See the log file for details:  /tmp/jupyterlab-debug-apjfo1g1.log
No labextension named "@webio/jupyter-lab-provider" installed
[LabBuildApp] JupyterLab 2.2.6
[LabBuildApp] Building in /home/jared/opt/anaconda3/envs/jupyterlab2/share/jupyter/lab
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
Process(`/home/jared/opt/anaconda3/envs/jupyterlab2/bin/jupyter lab build`, ProcessExited(0))

I've been having problems installing on Jupyter lab 2.x (separate issue) and I spent a lot of time thinking the ValueError: No linked package for @webio/webio line was the cause of the problem and trying to figure out what was happening in the log file when this was actually the expected behavior.

Ideally, this function should print some kind of message if either of these two commands fail indicating that it shouldn't represent a problem.

Context

pkg> status WebIO
Status `~/.julia/environments/v1.5/Project.toml`
  [0f1e0344] WebIO v0.8.15
julia> versioninfo()
Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
$ jupyter labextension list
JupyterLab v2.2.6
No installed extensions
peterquirk commented 3 years ago

I can't get WebIO.install_jupyterlab_extension() to work with JupyterLab 3.09 and Julia 1.5.3 in an Anaconda environment on Windows 10. The documentation says that that the function takes optional arguments to define the path to jupyter.exe and a couple of flags to control conda.jl. However, the function signature doesn't show any arguments:

`using MethodAnalysis methodinstances(WebIO.install_jupyter_labextension)

2-element Array{Core.MethodInstance,1}: MethodInstance for install_jupyter_labextension() MethodInstance for install_jupyter_labextension(::Nothing)`

Within an Anaconda environment you shouldn't have to specify the path to the Jupyter executable.