Created
January 21, 2022 06:31
-
-
Save jtmoon79/779754ec5342166ecb1ce0a9e1fbbc32 to your computer and use it in GitHub Desktop.
Python pip wrapper
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
#!/usr/bin/env bash | |
# | |
# wrap python pip commands with helpful but tedious-to-write options | |
# | |
set -e | |
set -u | |
cmd=${1-help} | |
shift | |
declare -a args=() | |
if [[ "${cmd}" == 'install' ]]; then | |
declare -a args=( | |
'--disable-pip-version-check' | |
'--no-python-version-warning' | |
) | |
elif [[ "${cmd}" == 'list' ]]; then | |
declare -a args=( | |
'--disable-pip-version-check' | |
'--no-python-version-warning' | |
) | |
fi | |
# https://github.com/pypa/pip/issues/7883 | |
export PYTHON_KEYRING_BACKEND="keyring.backends.null.Keyring" | |
# https://stackoverflow.com/a/28002687/471376 | |
export PYTHONWARNINGS="ignore:Unverified HTTPS request" | |
set -x | |
exec \ | |
${PYTHON-python3} \ | |
-m pip \ | |
"${cmd}" \ | |
"${args[@]}" \ | |
"${@}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment