Created
December 28, 2017 20:52
-
-
Save Fedalto/a71ac6eed2af8b4d3856523c880c114d to your computer and use it in GitHub Desktop.
Modify the requirements.txt file and upgrade all Python libraries to the latest version.
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
#!/bin/bash | |
pip list --format=columns --outdated | \ | |
sed -n '3,$p' | \ | |
while IFS=" " read -r package old_version new_version extra | |
do | |
for requirements_file in "$@" | |
do | |
if grep -q ${package} ${requirements_file}; then | |
echo "${package}: ${old_version} -> ${new_version}" | |
fi | |
sed -i "s#${package}==${old_version}#${package}==${new_version}#" $requirements_file | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: