Last active
July 13, 2019 12:09
-
-
Save ashwinvis/9de22a0190a16717691783d22c2d0a46 to your computer and use it in GitHub Desktop.
Useful aliases for Python and pew and conda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## General stuff | |
## Uncomment if pip cache takes up too much space | |
# alias pip="python -m pip --no-cache-dir" | |
## or even better simply symlink ~/.cache/pip | |
alias spyder='env python /usr/bin/spyder' | |
alias spyder3='env python3 /usr/bin/spyder3' | |
alias jupyter-clean-checkpoints='find -name ".ipynb_checkpoints" -type d | xargs rm -rf' | |
alias ipcluster-mpi='ipcluster start -n 2 --engines=MPIEngineSetLauncher' | |
## Install / Uninstall your virtualenvs to appear as kernels, allowing you to launch them from a | |
## system-wide or user-wide Jupyter Lab / Notebook installation | |
## Similar functionality is offered by https://github.com/Anaconda-Platform/nb_conda_kernels | |
alias ipykernel-install='ipython kernel install --user --name=py-$(basename $VIRTUAL_ENV)' | |
alias ipykernel-uninstall='jupyter kernelspec uninstall py-$(basename $VIRTUAL_ENV)' | |
alias ipykernel-list='jupyter kernelspec list | grep "\/py.*"' | |
## Pew aliases to behave like virtualenvwrapper | |
alias workon='pew workon' | |
alias deactivate='exit' | |
alias mkvirtualenv='pew new' | |
alias lsvirtualenv='pew ls' | |
alias rmvirtualenv='pew rm' | |
alias cpvirtualenv='pew cp' | |
alias cdproject='cd $(cat $VIRTUAL_ENV/.project)' | |
alias cdsitepackages='cd $(pew sitepackages_dir)' | |
alias cdvirtualenv='cd $(pew dir)' | |
## Conda aliases to behave like virtualenvwrapper | |
# alias workon='conda activate' | |
# alias deactivate='conda deactivate' | |
# alias mkvirtualenv='conda create' | |
# alias lsvirtualenv='conda-env list' | |
# alias rmvirtualenv='conda-env remove' | |
# function cpvirtualenv{ | |
# conda create --clone $1 --name $2 | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also
Working with virtual environments