Last active
August 3, 2019 13:17
-
-
Save ronelliott/5182246 to your computer and use it in GitHub Desktop.
Helpful Bash Aliases for Pip
This file contains hidden or 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
alias pir="pip install -r requirements.txt" | |
alias pip-upgrade-all="pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs pip install -U" | |
pip_freeze() { | |
echo "Freezing to 'requirements.txt'" | |
pip freeze > requirements.txt | |
} | |
pip_install() { | |
pip install $@ | |
} | |
pip_uninstall() { | |
pip uninstall -y $@ | |
} | |
pip_install_freeze() { | |
pip_install $@ && pip_freeze | |
} | |
pip_uninstall_freeze() { | |
pip_uninstall $@ && pip_freeze | |
} | |
alias pi='pip install' | |
alias pif=pip_install_freeze | |
alias pf=pip_freeze | |
alias pu='pip uninstall -y' | |
alias puf=pip_uninstall_freeze |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Came from your Coderwall. You've avoided a pitfall by breaking the functions into multiple lines for this gist, but the original post is problematic. For the functions you need to add a
;
before the closing curly bracket to avoid a syntax error on one-liners. For example,pip_install() { pip install $@; }
.Been a while since I messed around with functions in a bash profile and it took a bit of time to track that down. Thanks for posting the gist -- helpful to simplify routine pip operations ^_^