Browse Source

Improved jupyter kernel aliases to get better names for generated kernels

master
Micah Halter 1 month ago
parent
commit
23f204a974
Signed by: mehalter GPG Key ID: 4224A6EA9A8CAAA8
1 changed files with 12 additions and 2 deletions
  1. +12
    -2
      zsh/.config/zsh/aliases

+ 12
- 2
zsh/.config/zsh/aliases View File

@ -90,10 +90,20 @@ vactivate() {
}
alias pysetup='python -m pip install --upgrade pip && python -m pip install jupyter pynvim black pylint'
kernnew() {
basename $VIRTUAL_ENV 2>/dev/null >/dev/null && python -m ipykernel install --user --name=$(basename $VIRTUAL_ENV)
if basename $VIRTUAL_ENV 2>/dev/null >/dev/null; then
KERN_NAME=$(basename $VIRTUAL_ENV)
[[ $KERN_NAME = 'env' ]] && KERN_NAME=$(basename $(dirname $VIRTUAL_ENV))
KERN_NAME=$(echo "$KERN_NAME-$(basename $VIRTUAL_ENV)" | awk '{print tolower($0)}')
python -m ipykernel install --user --name=$KERN_NAME
fi
}
kerndel() {
basename $VIRTUAL_ENV 2>/dev/null >/dev/null && jupyter kernelspec uninstall $(basename $VIRTUAL_ENV)
if basename $VIRTUAL_ENV 2>/dev/null >/dev/null; then
KERN_NAME=$(basename $VIRTUAL_ENV)
[[ $KERN_NAME = 'env' ]] && KERN_NAME=$(basename $(dirname $VIRTUAL_ENV))
KERN_NAME=$(echo "$KERN_NAME-$(basename $VIRTUAL_ENV)" | awk '{print tolower($0)}')
jupyter kernelspec uninstall $KERN_NAME
fi
}
httpstart() {
port=8080


Loading…
Cancel
Save