Skip to content

Reject incompatible Python pins before downloading - #89

Draft
zanieb wants to merge 3 commits into
mainfrom
zb/bughunt100/084-incompatible-python-pin
Draft

zanieb wants to merge 3 commits into
mainfrom
zb/bughunt100/084-incompatible-python-pin

Conversation

@zanieb

@zanieb zanieb commented Jul 16, 2026 •

Copy link
Copy Markdown
Member

If .python-version contains 3.12 but the project requires Python >=3.14, uv can download Python 3.12 before rejecting it. Check the pin before downloading.

@zaniebot
zaniebot force-pushed the zb/bughunt100/084-incompatible-python-pin branch 2 times, most recently from 2dd9669 to bee1284 Compare July 16, 2026 06:36
@zaniebot zaniebot added priority:3 Normal: useful features, documentation, usability, or routine efficiency improvements. size:2 Moderate: one subsystem with meaningful invariants, edge cases, or operational evidence to inspect. bug Something isn't working risk:2 Low, contained risk of minor incorrect behavior with straightforward recovery. labels Sep 9, 2026
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughunt100/084-incompatible-python-pin branch from bee1284 to 5463a13 Compare September 30, 2026 02:35
@codspeed

codspeed Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 54 untouched benchmarks
⏩ 35 skipped benchmarks1


Comparing zb/bughunt100/084-incompatible-python-pin (7b99c0e) with main (301799d)

Open in CodSpeed

Footnotes

  1. 35 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughunt100/084-incompatible-python-pin branch 2 times, most recently from 0e9e00e to 976a7f8 Compare October 8, 2026 00:46
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughunt100/084-incompatible-python-pin branch from 976a7f8 to 7b99c0e Compare October 8, 2026 04:03
Comment on lines +233 to +235
// Avoid downloading a pinned interpreter when its version range cannot satisfy the
// project's Python requirement.
self.validate_request()?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P2] Update the remaining snapshots affected by early validation

This changes the isolated-run error output too, but run_isolated_incompatible_python and run_groups_requires_python_errors still expect patch-qualified versions (3.9.[X] and 3.12.[X]). This call now rejects the requests before discovery, producing 3.9 and 3.12. Frozen-sync tests such as sync_lockfile_incompatible_python also retain the old interpreter announcement and patch-qualified error. These assertions no longer match the implementation; update the remaining affected snapshots.

Comment on lines +179 to +182
&& let Some(version) = python_request.as_pep440_version()
{
validate_project_requires_python_version(
&version,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P2] Preserve request ranges when identifying conflicting requirements

Converting a partial pin into a concrete version makes the reused helper identify incorrect conflicts. For example, with pin 3.12, project requirement >=3.12.5, and a selected group requiring >=3.13, the helper checks declarations against 3.12.0 and blames both requirements. The pin overlaps the project's requirement; only the group excludes it entirely. Keep the PythonRequest for the early diagnostic and filter contributing declarations with intersects_specifiers, reserving concrete-version diagnostics for discovered interpreters.

Comment on lines +693 to +696
// Avoid downloading a pinned interpreter when its version range cannot satisfy the
// project's Python requirement.
project_python.validate_request()?;

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.

Oh my gosh validation not on construction!? How was this not capture dby code quality review!?

This branch was successfully deployed

1 active (outdated) deployment
automations — 7b99c0e9 Deployed Oct 8, 2026 by astral-automations-bot[bot] via review-code-quality / report #8086
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority:3 Normal: useful features, documentation, usability, or routine efficiency improvements. risk:2 Low, contained risk of minor incorrect behavior with straightforward recovery. size:2 Moderate: one subsystem with meaningful invariants, edge cases, or operational evidence to inspect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants