Skip to content

fix(pipx): preserve options when reinstalling tools#9663

Merged
jdx merged 3 commits into
jdx:mainfrom
risu729:fix/pipx-reinstall-options
May 10, 2026
Merged

fix(pipx): preserve options when reinstalling tools#9663
jdx merged 3 commits into
jdx:mainfrom
risu729:fix/pipx-reinstall-options

Conversation

@risu729

@risu729 risu729 commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Reuse the normal pipx backend install flow when Python upgrades trigger pipx tool reinstalls.
  • Preserve install-time options such as uvx_args, pipx_args, extras, and per-tool uvx = false during those reinstalls.
  • Add coverage to the existing pipx/uvx e2e so mise up --bump python must pass uvx_args during the reinstall step.

Analysis

The report is true for the Python-upgrade reinstallation path, not for ordinary pipx tool upgrades. install_version_ already passes uvx_args and pipx_args, but PIPXBackend::reinstall_all hand-built fresh uv tool install / pipx reinstall commands after a Python upgrade. That bypassed the existing option handling and could reinstall a pipx tool without its configured extras or installer args.

I also checked the recently added npm package-manager install args. The npm backend applies npm_args, pnpm_args, bun_args, and aube_args inside its normal install_version_ path, and npm does not have a separate post-Node-upgrade reinstall path equivalent to PIPXBackend::reinstall_all.

Source: #7219

Testing

  • cargo fmt --all -- --check
  • cargo check --all-features
  • mise run test:e2e e2e/backend/test_pipx_uvx

Note: mise run format was also attempted, but it failed in the existing taplo check registry schema validation with repeated Invalid reference: https://mise.en.dev/schema/mise-registry-tool.json#/definitions/os errors. The schema formatting changes produced before that failure were not included.

This PR was generated by an AI coding assistant.

@greptile-apps

greptile-apps Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a bug where PIPXBackend::reinstall_all — called after a Python upgrade — would bypass all install-time option handling and reinstall pipx tools without their configured uvx_args, pipx_args, extras, or per-tool uvx settings. The fix replaces the hand-rolled UV/pipx commands with a direct call to install_version (which already handles all those options) and adds a functional e2e assertion verifying that an --with rich extra is preserved through the upgrade cycle.

  • src/backend/pipx.rs: reinstall_all now builds an InstallContext with force: true and delegates to b.install_version(ctx, tv), inheriting full option-handling from install_version_. The ToolVersion objects returned by list_installed_versions carry the configured options from .mise.toml when the installed version matches a toolset entry, so options are correctly threaded through.
  • e2e/backend/test_pipx_uvx: Adds uvx_args = \"--with rich\" to the mkdocs fixture and, after mise up --bump python, directly verifies that import rich succeeds inside the reinstalled venv — a functional check independent of log-format details.

Confidence Score: 5/5

Safe to merge; the refactor correctly threads install options through the existing install_version path and the new e2e assertion directly validates the behaviour being fixed.

The change is narrow and the logic is sound: list_installed_versions returns ToolVersion objects that carry options from the toolset config when the installed version matches a configured entry, so delegating to install_version with force: true preserves all install-time options that were lost before. The force: true flag triggers the existing uninstall-then-reinstall flow, mirroring the original sequential uv tool uninstall + uv tool install pattern. The e2e test validates end-to-end that --with rich (via uvx_args) survives a Python bump reinstall.

No files require special attention.

Reviews (3): Last reviewed commit: "Merge branch 'main' into fix/pipx-reinst..." | Re-trigger Greptile

Comment thread e2e/backend/test_pipx_uvx Outdated

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request adds support for uvx_args in the pipx backend and refactors the reinstall_all function to use the standard install_version interface. A review comment points out that the reinstall_all implementation hardcodes dry_run: false in the InstallContext, which could lead to unexpected system changes if a user expects a dry run to be respected.

Comment thread src/backend/pipx.rs
@risu729

This comment was marked as outdated.

@risu729 risu729 marked this pull request as ready for review May 7, 2026 14:10
@jdx jdx merged commit 2e50c0f into jdx:main May 10, 2026
33 checks passed
@risu729 risu729 deleted the fix/pipx-reinstall-options branch May 10, 2026 13:29
mise-en-dev added a commit that referenced this pull request May 11, 2026
### 🚀 Features

- **(cli)** add minimum release age flag to lock and ls-remote by
@risu729 in [#9269](#9269)
- **(config)** add run field for hooks by @risu729 in
[#9718](#9718)
- **(github)** add native oauth token source by @jdx in
[#9654](#9654)
- **(oci)** scope build to project config by default by @jdx in
[#9766](#9766)
- add support for prefixed latest version queries in outdated checks by
@roele in [#9767](#9767)

### 🐛 Bug Fixes

- **(activate)** guard bash chpwd hook under nounset by @risu729 in
[#9716](#9716)
- **(backend)** date-check latest stable fast path by @risu729 in
[#9650](#9650)
- **(config)** parse core tool options consistently by @risu729 in
[#9742](#9742)
- **(exec)** propagate __MISE_DIFF so nested mise recovers pristine PATH
by @jdx in [#9765](#9765)
- **(forgejo)** include prereleases when opted in by @risu729 in
[#9717](#9717)
- **(github)** avoid caching empty release assets by @risu729 in
[#9616](#9616)
- **(java)** resolve lockfile URLs from metadata by @risu729 in
[#9719](#9719)
- **(lock)** cache unavailable github attestations by @risu729 in
[#9741](#9741)
- **(pipx)** preserve options when reinstalling tools by @risu729 in
[#9663](#9663)
- **(python)** skip redundant lockfile provenance verification by
@risu729 in [#9739](#9739)
- **(vfox)** run pre_uninstall hook by @risu729 in
[#9662](#9662)

### 🚜 Refactor

- **(schema)** extract tool options definition by @risu729 in
[#9649](#9649)

### ⚡ Performance

- **(aqua)** bake rkyv aqua package blobs by @risu729 in
[#9535](#9535)

### 📦️ Dependency Updates

- lock file maintenance by @renovate[bot] in
[#9773](#9773)

### 📦 Registry

- add vector
([github:vectordotdev/vector](https://github.com/vectordotdev/vector))
by @kquinsland in [#9761](#9761)
- add oc and openshift-install (http backend) by @konono in
[#9669](#9669)

### New Contributors

- @konono made their first contribution in
[#9669](#9669)
- @kquinsland made their first contribution in
[#9761](#9761)
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