Skip to content

Honor [pipx.run] for typed --spec app names on the uv backend - #2006

Merged
gaborbernat merged 5 commits into
pypa:mainfrom
DSeaStar:fix/pipx-run-spec-honors-entry-point
Aug 25, 2026
Merged

gaborbernat merged 5 commits into
pypa:mainfrom
DSeaStar:fix/pipx-run-spec-honors-entry-point

Conversation

@DSeaStar

Copy link
Copy Markdown

Summary

  • uv tool run has no knowledge of pipx's [pipx.run] entry-point group. After 🐛 fix(run): discover entry points for inferred names #1996, pipx run coherent.test already falls off the uvx fast-path because the name normalizes, but pipx run --spec <spec> <app> still handed the typed app name to uv tool run.
  • When that typed name is not the PEP 503-normalized distribution name (the usual [pipx.run] case, e.g. pipx run --spec 'coherent.test>=0.7.0' coherent.test), route through the venv path so _find_entry_point(..., "pipx.run") can honor it. Matching names such as pipx run --spec pycowsay pycowsay still use uv tool run.
  • Local-path / VCS --spec values also take the venv path, since they are not requirement names uv tool run can look up as console scripts.

Fixes #2004.

Test plan

  • test_run_spec_typed_pipx_run_name_skips_uv_tool_run — --spec coherent.test>=0.7.0 coherent.test does not call run_via_uv_tool_run
  • test_run_spec_matching_name_uses_uv_tool_run — --spec pycowsay pycowsay still uses the uvx fast-path
  • test_run_spec_honors_dotted_pipx_run_entry_point — local project with only [pipx.run] empty.project runs via the venv path under --backend uv
  • Existing inferred-name / --spec tests still pass

DSeaStar and others added 5 commits August 14, 2026 15:14
uv tool run has no knowledge of pipx's [pipx.run] group, so a typed
app name that is not the PEP 503-normalized distribution name now
goes through the venv path instead.
The regression covered the InvalidRequirement path and missed parsed specs such as registry requirements and direct references. Exercise each branch through CLI behavior and mock os.execvpe.

The uv guide described [pipx.run] as unsupported. Align its cache guidance with the routing predicate.
Ruff 0.16 reports selector codes as fixable configuration errors. Store canonical names so Ruff accepts the project config without a migration pass.
Routing a named `--spec` to the venv path means a spec without a
distribution name now pays for a throwaway venv, since pipx installs the
package once to learn its name and once for the run. `_prepare_venv` left
`package_name_from_spec` to resolve its own backend, so that first venv
ignored `--backend uv` and fell back to pip. Pass the backend through, and
note the double install in the uv how-to.

`test_run_matching_name_uses_uv_tool_run` patched `os.execvpe`, which
`exec_app` reaches on POSIX but not on Windows. There the patch never
fires, so the test shells out to a real `uv tool run` and then trips over
a mock that recorded no call. Patch the handover in `run_uv` instead, and
assert that it happened.

The changelog promised `[pipx.run]` discovery for `--spec` runs. The guard
delivers it for an app name the spec does not carry; an app named after
the package still goes to uvx, which does not read `[pipx.run]` metadata.
State that limit in the fragment and the how-to.
@gaborbernat
gaborbernat enabled auto-merge (squash) August 25, 2026 03:56
@gaborbernat
gaborbernat merged commit eb497ee into pypa:main Aug 25, 2026
17 checks passed
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.

[pipx.run] entry points are not honored under the uv backend (uv tool run)

2 participants