diff options
author | thomasjm <tom@codedown.io> | 2024-05-13 16:19:39 -0700 |
---|---|---|
committer | Matthieu Coudron <886074+teto@users.noreply.github.com> | 2024-05-15 12:08:08 +0200 |
commit | 1a53d626d9b14045cd80ac200d0004f25b298596 (patch) | |
tree | 33d56ae66492a971c7ff7a926bcd59b76979dbbb | |
parent | 05789ac113468e5bdf539002ccc0cb60d34f8730 (diff) |
bash-kernel: fix and add smoke test
-rw-r--r-- | pkgs/development/python-modules/bash-kernel/default.nix | 20 | ||||
-rw-r--r-- | pkgs/development/python-modules/bash-kernel/test.ipynb | 26 |
2 files changed, 42 insertions, 4 deletions
diff --git a/pkgs/development/python-modules/bash-kernel/default.nix b/pkgs/development/python-modules/bash-kernel/default.nix index c3ab6083ba1dd..57f28860fca92 100644 --- a/pkgs/development/python-modules/bash-kernel/default.nix +++ b/pkgs/development/python-modules/bash-kernel/default.nix @@ -6,7 +6,7 @@ , ipykernel , python , pexpect -, bash +, bashInteractive , substituteAll }: @@ -24,7 +24,7 @@ buildPythonPackage rec { patches = [ (substituteAll { src = ./bash-path.patch; - bash = lib.getExe bash; + bash = lib.getExe bashInteractive; }) ]; @@ -45,8 +45,20 @@ buildPythonPackage rec { ${python.pythonOnBuildForHost.interpreter} -m bash_kernel.install --prefix $out ''; - # no tests - doCheck = false; + checkPhase = '' + runHook preCheck + + # Create a JUPYTER_PATH with the kernelspec + export JUPYTER_PATH=$(mktemp -d) + mkdir -p $JUPYTER_PATH/kernels/bash + echo '{ "language": "bash", "argv": [ "${python}/bin/python", "-m", "bash_kernel", "-f", "{connection_file}" ] }' > $JUPYTER_PATH/kernels/bash/kernel.json + + # Evaluate a test notebook with papermill + cd $(mktemp -d) + ${python.withPackages (ps: [ps.papermill])}/bin/papermill --kernel bash ${./test.ipynb} out.ipynb + + runHook postCheck + ''; meta = with lib; { description = "Bash Kernel for Jupyter"; diff --git a/pkgs/development/python-modules/bash-kernel/test.ipynb b/pkgs/development/python-modules/bash-kernel/test.ipynb new file mode 100644 index 0000000000000..4d061381b96d1 --- /dev/null +++ b/pkgs/development/python-modules/bash-kernel/test.ipynb @@ -0,0 +1,26 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "echo hi" + ] + } + ], + "metadata": { + "kernel_info": { + "display_name": "Unknown", + "name": "bash" + }, + "language_info": { + "file_extension": ".ipynb", + "name": "bash", + "version": "5.0" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} |