Skip to content

Infer uv tool Python requests from remote distributions with static metadata - #19583

Draft
zanieb wants to merge 13 commits into
mainfrom
zb/python-require-infer-registry
Draft

zanieb wants to merge 13 commits into
mainfrom
zb/python-require-infer-registry

Conversation

@zanieb

@zanieb zanieb commented May 27, 2026 •

Copy link
Copy Markdown
Member

Follows #19577.

Closes #14110.
Closes #19079.
Closes #19676.

@zanieb
zanieb force-pushed the zb/python-request-infer branch from e2ef6e8 to 52621f5 Compare May 27, 2026 22:53
@zanieb
zanieb force-pushed the zb/python-require-infer-registry branch from 4480724 to 676c188 Compare May 27, 2026 22:56
@zanieb
zanieb force-pushed the zb/python-request-infer branch from 52621f5 to 613f28c Compare May 28, 2026 04:31
@zanieb
zanieb force-pushed the zb/python-require-infer-registry branch from 676c188 to bf181da Compare May 28, 2026 04:34
@zanieb
zanieb force-pushed the zb/python-request-infer branch from 613f28c to a8dadea Compare May 28, 2026 13:07
@zanieb
zanieb force-pushed the zb/python-require-infer-registry branch from bf181da to 53489ac Compare May 28, 2026 13:08
zanieb added a commit that referenced this pull request May 28, 2026
…ons (#19577)

Currently, we determine the Python version to use then attempt to
resolve the target package. If the Python version is not compatible, we
fail.

For source trees, we can peek at the `pyproject.toml` to infer the
Python version request from the `requires-python` range instead, which
reduces failures and aligns with user expectations. In #19583 (still
needs self-review), this is expanded to include inference from
distribution metadata, e.g., from wheels on an index.

Closes #8206

Related to

- #14110 
- #19079
Base automatically changed from zb/python-request-infer to main May 28, 2026 13:21
@zanieb
zanieb force-pushed the zb/python-require-infer-registry branch from 53489ac to 1660ab0 Compare May 28, 2026 13:23
Comment thread crates/uv/src/commands/tool/install.rs Outdated
Comment on lines +81 to +83
defer_registry_requires_python: bool,
require_selected_interpreter: bool,
removed_invalid_tool_receipt: bool,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These seem weird

Comment thread crates/uv/src/commands/tool/install.rs Outdated
Comment on lines +59 to +62
constraint_sources: &[RequirementsSource],
override_sources: &[RequirementsSource],
exclude_sources: &[RequirementsSource],
build_constraint_sources: &[RequirementsSource],

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We should avoid churn of htese

@astral-sh-bot

astral-sh-bot Bot commented May 28, 2026 •

Copy link
Copy Markdown

uv test inventory changes

This PR changes the tests when compared with the latest main baseline.

  • Added tests: 31
  • Removed tests: 0
  • Changed suites: 4
uv: +6 / -0

Added:

  • uv::commands::tool::common::tests::registry_tool_python_alternatives_prefer_downloads_and_current
  • uv::commands::tool::common::tests::registry_tool_python_alternatives_select_latest_stable_patch
  • uv::commands::tool::common::tests::registry_tool_python_candidates_keep_same_minor_patches
  • uv::commands::tool::common::tests::registry_tool_python_minor_marker_uses_python_version
  • uv::commands::tool::common::tests::registry_tool_python_targets_exclude_automatic_prereleases
  • uv::commands::tool::common::tests::registry_tool_python_targets_preserve_current_prerelease

Removed: none

uv-distribution-types: +1 / -0

Added:

  • uv-distribution-types::prioritized_distribution::tests::exact_tags_select_and_preserve_best_wheel

Removed: none

uv-resolver: +4 / -0

Added:

  • uv-resolver::resolver::environment::tests::alternative_can_create_descendant_forks
  • uv-resolver::resolver::environment::tests::alternative_is_preserved_when_narrowing
  • uv-resolver::resolver::environment::tests::alternative_uses_only_fork_markers
  • uv-resolver::resolver::tests::alternative_local_error_classification

Removed: none

uv::it: +20 / -0

Added:

  • uv::it::tool_install::tool_install_latest_selects_compatible_registry_python
  • uv::it::tool_install::tool_install_registry_resolution_applies_exact_target_tags
  • uv::it::tool_install::tool_install_registry_resolution_applies_no_build
  • uv::it::tool_install::tool_install_registry_resolution_applies_target_tags
  • uv::it::tool_install::tool_install_registry_resolution_applies_upgrade_bounds
  • uv::it::tool_install::tool_install_registry_resolution_falls_back_without_python_downloads
  • uv::it::tool_install::tool_install_registry_resolution_honors_lowest
  • uv::it::tool_install::tool_install_registry_resolution_honors_overrides
  • uv::it::tool_install::tool_install_registry_resolution_preserves_installed_tool
  • uv::it::tool_install::tool_install_upgrade_selects_higher_registry_solution_with_python
  • uv::it::tool_run::tool_run_exact_selects_compatible_registry_python
  • uv::it::tool_run::tool_run_latest_does_not_downgrade_without_python_downloads
  • uv::it::tool_run::tool_run_latest_selects_compatible_registry_python
  • uv::it::tool_run::tool_run_latest_selects_python_from_wheel_metadata
  • uv::it::tool_run::tool_run_registry_resolution_constrains_target_markers
  • uv::it::tool_run::tool_run_registry_resolution_falls_back_without_python_downloads
  • uv::it::tool_run::tool_run_registry_resolution_honors_constraints
  • uv::it::tool_run::tool_run_registry_resolution_preserves_current_patch_compatible_python
  • uv::it::tool_run::tool_run_registry_resolution_preserves_explicit_python
  • uv::it::tool_run::tool_run_registry_resolution_preserves_installed_tool

Removed: none

@basnijholt

Copy link
Copy Markdown

Just wanted to leave a note of appreciation @zanieb! This issue has been a massive PITA and I am glad it will be fixed 🙇‍♂️

@zanieb
zanieb force-pushed the zb/python-require-infer-registry branch from 96002b5 to f0ad459 Compare June 10, 2026 17:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants