UBC-DSCI / jupyterhub-infrastructure

0 stars 0 forks source link

Need to get altair_data_server working with notebooks in sub-directories on JupyterHub #3

Open ttimbers opened 3 years ago

ttimbers commented 3 years ago

We (@phaustin @lheagy @trevorcampbell and myself) are developing a course where we will be having students work on a JupyterHub, but use Altair as the Python data viz library. We chose Altair in part because it is very compatible with autograding in a relatively simple way (no need for visual regression testing). This is a large course and we need to heavily rely on autograding.

One big limitation I am learning from its use in another course I co-developed, is that it's default behaviour embeds the figure data into the Jupyter notebook (due to it stemming from Vega - this is what Vega does). This is very problematic, as it very quickly inflates the size of notebooks... (if you want to learn more, see chapter 12 "Sharing Altair Visualizations" in module 7 of our data viz course).

There are a few ways to work around this, with altair_data_server (https://github.com/altair-viz/altair_data_server) being the most elegant. However, there is a challenge currently with making this work when notebooks are in subfolders of a JupyterHub... It is documented in this issue here: https://github.com/altair-viz/altair_data_server/issues/8 .

In early-stage conversations with @yuvipanda, he said that a cursory read of the linked issues make him believe that we can make it work for jupyterhub with jupyter-server-proxy. In particularly with https://github.com/altair-viz/altair_data_server/pull/41

ttimbers commented 3 years ago

Thanks to @yuvipanda - this PR very elegantly solves the problem: https://github.com/altair-viz/altair_data_server/pull/47

Until that gets merged, we can install that version of altair_data_server can be installed in our Docker images via:

conda install jupyter-server-proxy -c conda-forge
pip install -U git+https://github.com/yuvipanda/altair_data_server@better-hub-support-2

Leaving this open until that PR is merged.

trevorcampbell commented 2 years ago

@ttimbers after spinning out 4 new repos from this one, I think this issue should be moved to the new jupyterhub-infrastructure repo. This repo will soon just be for the main rudaux course orchestration code. Closing.

trevorcampbell commented 2 years ago

I just learned I can transfer issues :) off it goes!