Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(pipx): upgrade shared pip for release age installs#10472

Merged
jdx merged 8 commits into
jdx:mainfrom
risu729:codex-20260616-032504-3b3c01
Jun 17, 2026
Merged

fix(pipx): upgrade shared pip for release age installs#10472
jdx merged 8 commits into
jdx:mainfrom
risu729:codex-20260616-032504-3b3c01

Conversation

@risu729

@risu729 risu729 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • run pipx upgrade-shared before pipx fallback installs that forward minimum_release_age to pip
  • default modern pipx to the pip backend for these installs so --uploaded-prior-to is handled by pip, not uv

Background

pipx forwards pipx install --pip-args into shared-library bootstrap (pip install --upgrade pip>=23.1), not just the package install. When mise passes --pip-args=--uploaded-prior-to=..., bootstrap pip (from ensurepip) may not understand that flag and shared pip never upgrades successfully.

This is the same chicken-and-egg class of bug as pypa/pipx#544 (install pip_args breaking shared pip upgrade with flags the bootstrap pip does not support). There is no open pipx issue specifically for --uploaded-prior-to; upstream discussion is mostly pypa/pipx#1811 / #1801.

Prior mise work on this area:

  • #9190 — forward install_before / release-age cutoff to pipx and uv
  • #10138 — titled as shared-pip upgrade support but merged as docs only; the bootstrap workaround was not implemented

Running pipx upgrade-shared first (without release-age flags) makes shared pip valid so the subsequent pipx install shared_libs.create() is a no-op and --uploaded-prior-to only applies to the package install.

Related reports: discussion #10088, discussion #10484.

Reproduction

Reproduced with an isolated PIPX_HOME by downgrading pipx's shared pip to pip==25.3, then running:

pipx install pre-commit==4.6.0 --backend pip --pip-args=--uploaded-prior-to=2026-06-09T00:00:00Z

That failed with no such option: --uploaded-prior-to. Running pipx upgrade-shared first upgraded shared pip, and the same install then succeeded.

Testing

  • mise x cargo -- cargo fmt --check

Full local tests were not run.

Discussion

Summary by CodeRabbit

  • Bug Fixes
    • Improved pipx installs with release date constraints: when minimum_release_age/limits apply, mise now attempts to upgrade pipx’s shared pip environment before running pipx install, so pip options such as --uploaded-prior-to work as expected.
  • Documentation
    • Updated pipx “minimum_release_age” guidance to reflect the upgrade-first behavior, removing the need for manual Python/pip compatibility prerequisites.
  • Tests
    • Added an end-to-end test for the pipx minimum release age flow to verify the shared pip environment behavior.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 8af68d16-d742-4d84-aae8-3616bf275a87

📥 Commits

Reviewing files that changed from the base of the PR and between f501a59 and 1127ffb.

📒 Files selected for processing (1)
  • e2e/backend/test_pipx_minimum_release_age

📝 Walkthrough

Walkthrough

When ctx.before_date is set during pipx install, the backend now runs pipx upgrade-shared before the actual install command; any upgrade failure is logged at debug level and does not halt the install. The e2e test verifies this pre-step occurs and that the tool installs successfully. Documentation is updated to reflect this automatic upgrade behavior.

Changes

pipx upgrade-shared for minimum_release_age

Layer / File(s) Summary
Pre-install upgrade-shared logic and docs
src/backend/pipx.rs, docs/dev-tools/backends/pipx.md
When ctx.before_date is set, pipx upgrade-shared runs before install (errors logged at debug, non-fatal). Documentation updated to note that mise automatically upgrades the shared pip environment.
E2E test for upgrade-shared and minimum_release_age
e2e/backend/test_pipx_minimum_release_age
Test disables unrelated MISE features, configures minimum_release_age = "7d" with pinned python and pipx versions, installs a pipx tool via mise install, and verifies execution succeeds.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • jdx/mise#10279: Introduces minimum_release_agebefore_date plumbing; this PR implements the pipx-specific upgrade-shared pre-step behavior when ctx.before_date is set.
  • jdx/mise#10310: Aligns with core before_date/minimum_release_age handling for resolving "latest" versions; this PR adds the pipx-specific upgrade-shared pre-step to support that filtering.
  • jdx/mise#10344: Both PRs integrate the minimum_release_age cutoff flow; #10344 resolves the CLI flag into before_date, and this PR uses ctx.before_date to conditionally trigger pipx upgrade-shared.

Poem

🐇 Before we install, let's upgrade the share,
pipx upgrade-shared with logger care!
When before_date calls, we answer with speed,
Swallowing errors so the install can proceed.
The rabbit hops forward, --uploaded-prior-to in sight,
Every version constraint finds its right! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: upgrading pipx's shared pip environment for installs with release age constraints, which is the core fix implemented across the backend code and tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a chicken-and-egg bootstrap failure that occurred when minimum_release_age was set and pipx was used as the install backend: pipx was forwarding --pip-args=--uploaded-prior-to=... into the shared-library bootstrap step, but the ensurepip bootstrap pip doesn't recognize that flag, so shared pip never upgraded successfully.

  • Adds an upgrade-shared pre-flight call (without release-age flags) whenever ctx.before_date is set on the pipx fallback path, so shared pip is valid before the actual install runs. The step is wrapped in a non-fatal async {} / if let Err block, matching the codebase pattern.
  • Removes the now-unnecessary documentation note asking users to manually ensure pip >= 26.0, since mise handles the upgrade automatically.
  • Adds a focused end-to-end test (test_pipx_minimum_release_age) that forces the pipx fallback path via MISE_PIPX_UVX=0 and verifies a pipx:cowsay install completes end-to-end with minimum_release_age = \"7d\".

Confidence Score: 5/5

Safe to merge — the upgrade-shared step is best-effort and isolated to the per-tool PIPX_HOME, so a failure leaves behaviour identical to today.

The change is narrowly scoped: it only fires on the pipx fallback path when before_date is set, wraps the extra command in a non-fatal block, and each tool's PIPX_HOME is fully isolated so there is no cross-contamination between concurrent installs. The ? inside the async {} block returns from the block (not the outer function), so the error handling is correct. Documentation and test are consistent with the code.

No files require special attention.

Important Files Changed

Filename Overview
src/backend/pipx.rs Adds an upgrade-shared pre-flight step when before_date is set, wrapped in a non-fatal async block; pattern is idiomatic and correct
e2e/backend/test_pipx_minimum_release_age New end-to-end test for the pipx minimum_release_age flow; forces the pipx fallback path via MISE_PIPX_UVX=0 and verifies install succeeds
docs/dev-tools/backends/pipx.md Removes the outdated manual pip>=26.0 requirement since mise now handles shared pip upgrade automatically

Reviews (5): Last reviewed commit: "test(pipx): drop unnecessary fake system..." | Re-trigger Greptile

Comment thread src/backend/pipx.rs Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/backend/pipx.rs (1)

296-311: ⚡ Quick win

Consider making the upgrade-shared step fully non-fatal.

The .await? on line 306 will still propagate errors from pipx_cmd creation (e.g., config/toolset issues), aborting the install. Only errors from .execute() are caught and logged. Since the PR objectives describe this as ensuring pip is "current enough" and the error is logged at debug level, the intent appears to be a best-effort upgrade that should never block the main install.

If you want to make this truly non-fatal, wrap both the command creation and execution:

if let Err(err) = async {
    Self::pipx_cmd(
        &ctx.config,
        &["upgrade-shared"],
        self,
        &tv,
        &ctx.ts,
        ctx.pr.as_ref(),
    )
    .await?
    .execute()
}
.await
{
    debug!("failed to upgrade pipx shared libraries before install: {err:#}");
}

Alternatively, if config/toolset errors during upgrade-shared should abort the install (because they'd likely cause the main install to fail anyway), the current approach is reasonable.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/backend/pipx.rs` around lines 296 - 311, The upgrade-shared step
currently has a `.await?` after the `pipx_cmd` call that will propagate errors
from command creation, aborting the install. Only errors from `.execute()` are
caught and logged. To make this truly non-fatal as intended (since it's logged
at debug level and meant as a best-effort upgrade), wrap both the
`Self::pipx_cmd()` creation and the `.execute()` call together in an async block
so that all errors—whether from command creation or execution—are caught and
logged together rather than propagating the `.await?` error.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/backend/pipx.rs`:
- Around line 296-311: The upgrade-shared step currently has a `.await?` after
the `pipx_cmd` call that will propagate errors from command creation, aborting
the install. Only errors from `.execute()` are caught and logged. To make this
truly non-fatal as intended (since it's logged at debug level and meant as a
best-effort upgrade), wrap both the `Self::pipx_cmd()` creation and the
`.execute()` call together in an async block so that all errors—whether from
command creation or execution—are caught and logged together rather than
propagating the `.await?` error.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 954f7cb5-30c6-4c65-9e86-ade060c3beb5

📥 Commits

Reviewing files that changed from the base of the PR and between 542f4f8 and c7190cc.

📒 Files selected for processing (2)
  • docs/dev-tools/backends/pipx.md
  • src/backend/pipx.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/backend/test_pipx_minimum_release_age`:
- Line 2: The test script uses jq on line 34 but only declares python3 as a
required command at the beginning of the file. Add a require_cmd jq call near
the existing require_cmd python3 declaration to explicitly declare jq as a
required test dependency. This ensures the test fails immediately with a clear
diagnostic message if jq is not available, rather than failing later during
execution.
- Around line 5-11: The test script attempts to write a fake pipx script to
$HOME/bin/pipx without ensuring that the $HOME/bin directory exists first, which
will cause the test to fail in clean environments. Add a mkdir -p command to
create the $HOME/bin directory before the cat command that writes the fake pipx
script content between the EOF markers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 08f29b6b-33f9-4218-af91-f260424e0c96

📥 Commits

Reviewing files that changed from the base of the PR and between 8d44853 and f501a59.

📒 Files selected for processing (2)
  • e2e/backend/test_pipx_minimum_release_age
  • src/backend/pipx.rs
💤 Files with no reviewable changes (1)
  • src/backend/pipx.rs

Comment thread e2e/backend/test_pipx_minimum_release_age
Comment thread e2e/backend/test_pipx_minimum_release_age Outdated
@risu729

risu729 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Reviews resumed.

@risu729 risu729 marked this pull request as ready for review June 17, 2026 20:36
@jdx jdx merged commit b2abd9f into jdx:main Jun 17, 2026
34 checks passed
@risu729 risu729 deleted the codex-20260616-032504-3b3c01 branch June 17, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants