Skip to content

Instantly share code, notes, and snippets.

@gmolveau
Created September 3, 2024 08:48
Show Gist options
  • Save gmolveau/9d72c3c64544c4f95bd882d93cee55d1 to your computer and use it in GitHub Desktop.
Save gmolveau/9d72c3c64544c4f95bd882d93cee55d1 to your computer and use it in GitHub Desktop.
bash script to upgrade all outdated dependencies with python/pip
pip list --disable-pip-version-check --outdated --format=columns | tail -n +3 | awk '{print $1}' | xargs -n1 pip install -U || true
# explanations :
# pip list --disable-pip-version-check --outdated --format=columns : print as a column format only the outdated dependencies, and suppress the warning if pip is outdated as it messes up the output
# tail -n +3 : keep only the lines after the first two
# awk '{print $1}' : keep only the first column
# xargs -n1 pip install -U || true : install each dependency, never fails via the || true (to use in a CI or script env)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment