Skip to content

Commit 509ad49

Browse files
committed
Refine PIP package update logic with improved package detection and upgrade process
- Use `pip list --outdated` to identify outdated packages - Upgrade packages using `python3 -m pip` for better compatibility - Add conditional check to handle cases with no outdated packages - Improve output messaging for package update status
1 parent 668dcd3 commit 509ad49

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

scripts/update_packages.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,17 @@ if command -v pnpm &> /dev/null; then
102102
fi
103103

104104
if command -v pip &> /dev/null; then
105-
echo "Updating PIP packages..."
106-
pip install --upgrade pip
107-
pip freeze --local | cut -d= -f1 | xargs -n1 pip install --upgrade
105+
echo "Updating PIP and all installed Python packages..."
106+
107+
# Upgrade pip first
108+
python3 -m pip install --upgrade pip
109+
110+
# Upgrade all packages while resolving dependencies properly
111+
pip list --outdated --format=freeze | awk -F '==' '{print $1}' | xargs -r python3 -m pip install --upgrade
108112
fi
109113

110114

115+
111116
if command -v poetry &> /dev/null; then
112117
echo "Updating Poetry packages..."
113118
poetry self update

0 commit comments

Comments
 (0)