Data Science workgroup: Difference between revisions
imported>Ixxie No edit summary |
imported>Costrouc Adding jupyterlab instructions with nix-shell |
||
| Line 1: | Line 1: | ||
This workgroup is dedicated towards improving the state of the data science stack in Nixpkgs. This includes work on packages and modules for scientific computation, artificial intelligence and data processing, as well as data science IDEs. | This workgroup is dedicated towards improving the state of the data science stack in Nixpkgs. This includes work on packages and modules for scientific computation, artificial intelligence and data processing, as well as data science IDEs. | ||
=== JupyterLab === | |||
Work has been done to easily deploy arbitrary kernels and jupyter extensions with nix. There are some limitations due to jupyterlab extensions relying heavily on npm and webpack to compile the javascript modules. Thus an unpure setup is easiest to get it working. The following `default.nix` shell will install 20 jupyerlab extension + 4 kernels (c, python, go, and ansible). All that needs to be edited by user is kernels, additionalExtensions, and buildInputs. The rest is automatic and will launch a jupyterlab instance for you. | |||
<syntaxhighlight lang="nix"> | |||
{ pkgs ? import <nixpkgs> {}, pythonPackages ? pkgs.python36Packages }: | |||
let kernels = [ | |||
pkgs.python36Packages.ansible-kernel | |||
pythonPackages.jupyter-c-kernel | |||
pkgs.gophernotes | |||
]; | |||
additionalExtensions = [ | |||
"@jupyterlab/toc" | |||
"@jupyterlab/fasta-extension" | |||
"@jupyterlab/geojson-extension" | |||
"@jupyterlab/katex-extension" | |||
"@jupyterlab/mathjax3-extension" | |||
"@jupyterlab/plotly-extension" | |||
"@jupyterlab/vega2-extension" | |||
"@jupyterlab/vega3-extension" | |||
"@jupyterlab/xkcd-extension" | |||
"jupyterlab-drawio" | |||
"@jupyterlab/hub-extension" | |||
"jupyterlab_bokeh" | |||
]; | |||
in | |||
pkgs.mkShell rec { | |||
buildInputs = [ | |||
### Base Packages | |||
pythonPackages.jupyterlab pkgs.nodejs | |||
### Extensions | |||
pythonPackages.ipywidgets | |||
pythonPackages.ipydatawidgets | |||
pythonPackages.ipywebrtc | |||
pythonPackages.pythreejs | |||
pythonPackages.ipyvolume | |||
pythonPackages.jupyterlab-git | |||
pythonPackages.jupyterlab-latex | |||
pythonPackages.ipyleaflet | |||
pythonPackages.ipympl | |||
] ++ kernels; | |||
shellHook = '' | |||
TEMPDIR=$(mktemp -d -p /tmp) | |||
mkdir -p $TEMPDIR | |||
cp -r ${pkgs.python36Packages.jupyterlab}/share/jupyter/lab/* $TEMPDIR | |||
chmod -R 755 $TEMPDIR | |||
echo "$TEMPDIR is the app directory" | |||
# kernels | |||
export JUPYTER_PATH="${pkgs.lib.concatMapStringsSep ":" (p: "${p}/share/jupyter/") kernels}" | |||
# labextensions | |||
${pkgs.stdenv.lib.concatMapStrings | |||
(s: "jupyter labextension install --no-build --app-dir=$TEMPDIR ${s}; ") | |||
(pkgs.lib.unique | |||
((pkgs.lib.concatMap | |||
(d: pkgs.lib.attrByPath ["passthru" "jupyterlabExtensions"] [] d) | |||
buildInputs) ++ additionalExtensions)) } | |||
jupyter lab build --app-dir=$TEMPDIR | |||
# start jupyterlab | |||
jupyter lab --app-dir=$TEMPDIR | |||
''; | |||
} | |||
</syntaxhighlight> | |||
Some recent examples of work done on libraries: | Some recent examples of work done on libraries: | ||