Skip to content

Commit 1b71b71

Browse files
AI Assistantclaude
andcommitted
feat(upgrade-all): skip pip/pipx when uv is managing Python packages
Added detection to avoid redundant pip/pipx upgrades when UV is present, since UV is designed to replace both tools. Rationale: - UV is a modern, faster replacement for pip and pipx - Running pip/pipx upgrades alongside UV is redundant - UV handles both package installation (pip) and tool management (pipx) - Reduces upgrade time and eliminates conflicting package managers Changes: Stage 2 (Package Managers): - pip: Skip with "pip (uv is managing Python packages)" - pipx: Skip with "pipx (uv is managing Python tools)" Stage 4 (User Packages): - pipx packages: Skip with "pipx packages (uv tools handle this)" Detection logic: if command -v uv >/dev/null 2>&1; then log_skip "pip (uv is managing Python packages)" fi When UV is NOT present: - pip/pipx upgrade normally as before - No behavior change for systems without UV When UV IS present: Stage 2: ⏭ pip (uv is managing Python packages) ✓ uv (0.5.11 at /home/user/.local/bin/uv) ⏭ pipx (uv is managing Python tools) Stage 4: ✓ uv tool: ansible ✓ uv tool: black ... ⏭ pipx packages (uv tools handle this) Benefits: - Prevents package manager conflicts - Reduces upgrade time when UV is present - Clear messaging about which tool is managing Python packages - Encourages modern tooling adoption 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
1 parent cceed18 commit 1b71b71

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

scripts/upgrade_all.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,11 @@ stage_2_managers() {
198198

199199
# Language-specific package managers
200200
if command -v pip3 >/dev/null 2>&1; then
201+
# Skip pip if uv is managing Python packages
202+
if command -v uv >/dev/null 2>&1; then
203+
log_skip "pip (uv is managing Python packages)"
201204
# Check if pip module is actually available
202-
if ! python3 -m pip --version >/dev/null 2>&1; then
205+
elif ! python3 -m pip --version >/dev/null 2>&1; then
203206
log_skip "pip (python3 has no pip module)"
204207
elif [ "$DRY_RUN" = "1" ]; then
205208
log_info "DRY-RUN: pip upgrade"
@@ -237,7 +240,10 @@ stage_2_managers() {
237240
fi
238241

239242
if command -v pipx >/dev/null 2>&1; then
240-
if [ "$DRY_RUN" = "1" ]; then
243+
# Skip pipx if uv is managing Python tools
244+
if command -v uv >/dev/null 2>&1; then
245+
log_skip "pipx (uv is managing Python tools)"
246+
elif [ "$DRY_RUN" = "1" ]; then
241247
log_info "DRY-RUN: pip3 install --upgrade pipx"
242248
else
243249
# Check if in virtualenv - skip --user flag if so
@@ -556,7 +562,10 @@ stage_4_user_packages() {
556562

557563
# Pipx packages
558564
if command -v pipx >/dev/null 2>&1; then
559-
if [ "$DRY_RUN" = "1" ]; then
565+
# Skip pipx packages if uv is managing Python tools
566+
if command -v uv >/dev/null 2>&1; then
567+
log_skip "pipx packages (uv tools handle this)"
568+
elif [ "$DRY_RUN" = "1" ]; then
560569
log_info "DRY-RUN: pipx upgrade-all"
561570
else
562571
local temp_log=$(mktemp)

0 commit comments

Comments
 (0)