Skip to content
Snippets Groups Projects
Select Git revision
  • da3a2b3f15996a4cc04866105028e7e5e9a9a817
  • master default protected
  • safety
  • improvements
  • conda
  • singularity-no-venv
  • singularity
7 results

create_kernel.sh

Blame
  • Forked from Stefan Kesselheim / sc_venv_template
    30 commits behind the upstream repository.
    ebert1's avatar
    Jan Ebert authored
    We now assign once at the top; this makes portability changes with
    regard to this variable easier.
    da3a2b3f
    History
    create_kernel.sh 702 B
    #!/bin/bash
    
    SOURCE_PATH="${BASH_SOURCE[0]}"
    
    RELATIVE_PATH="$(dirname "$SOURCE_PATH")"
    ABSOLUTE_PATH="$(realpath "${RELATIVE_PATH}")"
    source "${ABSOLUTE_PATH}"/config.sh
    
    KERNELFILE="${ENV_DIR}"/kernel.sh
    
    echo the name is "$ENV_NAME"
    
    echo "Setting up the kernel script in the following dir: " "${KERNELFILE}"
    
    echo '#!/bin/bash
    
    source "'"${ABSOLUTE_PATH}"'"/activate.sh
    
    exec python -m ipykernel "$@"' > "${KERNELFILE}"
    
    chmod a+x "${KERNELFILE}"
    
    mkdir -p ~/.local/share/jupyter/kernels/"${ENV_NAME}"
    echo '{
     "argv": [
      "'"${KERNELFILE}"'",
      "-f",
      "{connection_file}"
     ],
     "display_name": "'"${ENV_NAME}"'",
     "language": "python"
    }' > ~/.local/share/jupyter/kernels/"${ENV_NAME}"/kernel.json