Skip to content

Retry uv pip install with an inferred Python constraint - #2396

Open
nikosavola wants to merge 1 commit into
j178:masterfrom
nikosavola:uv-python-constraint-retry
Open

Retry uv pip install with an inferred Python constraint#2396
nikosavola wants to merge 1 commit into
j178:masterfrom
nikosavola:uv-python-constraint-retry

Conversation

@nikosavola

Copy link
Copy Markdown
Contributor

When uv pip install fails to resolve because the venv's Python is too old for a (possibly transitive) dependency, parse the required Python version from uv's error, recreate the venv with that constraint, and retry once.

Closes #1618.

Copilot AI review requested due to automatic review settings July 24, 2026 08:36
@nikosavola
nikosavola requested a review from j178 as a code owner July 24, 2026 08:36
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.26087% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.31%. Comparing base (928dc5c) to head (b426e22).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
crates/prek/src/languages/python/python.rs 77.77% 30 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2396      +/-   ##
==========================================
- Coverage   93.38%   93.31%   -0.08%     
==========================================
  Files         129      129              
  Lines       27637    27774     +137     
==========================================
+ Hits        25810    25917     +107     
- Misses       1827     1857      +30     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI 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.

Pull request overview

This PR improves the Python hook installation flow by adding a targeted fallback when uv pip install fails due to the venv Python being too old for a (possibly transitive) dependency. It infers a minimum required Python version from uv’s resolution error output, recreates the venv using that inferred constraint, and retries dependency installation once.

Changes:

  • Refactors Python dependency installation into a dedicated install_dependencies helper and adds a single-retry path on resolution failure.
  • Implements infer_python_request(stderr) to extract the highest Python>=X.Y[.Z] bound from uv’s error output and converts it into a major.minor Python request.
  • Adds unit tests validating that inference selects the highest bound and drops patch versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 324ee60c15

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread crates/prek/src/languages/python/python.rs Outdated
@prek-ci-bot

prek-ci-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

📦 Cargo Bloat Comparison

Binary size change: +0.34% (29.2 MiB → 29.3 MiB)

Expand for cargo-bloat output

Head Branch Results

 File  .text     Size             Crate Name
 1.1%   2.3% 332.0KiB        aws_lc_sys aws_lc_0_42_0_aes_gcm_encrypt_avx512
 1.1%   2.3% 332.0KiB        aws_lc_sys aws_lc_0_42_0_aes_gcm_decrypt_avx512
 0.2%   0.5%  65.4KiB              prek <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.2%   0.4%  55.1KiB              prek <<prek::config::Config as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
 0.2%   0.3%  49.4KiB annotate_snippets annotate_snippets::renderer::render::render
 0.1%   0.3%  38.8KiB              prek prek::cli::run::run::run::{closure#0}
 0.1%   0.3%  37.8KiB              prek prek::run::{closure#0}
 0.1%   0.2%  34.3KiB              prek <prek::cli::RunOptions as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  30.1KiB     granit_parser <granit_parser::scanner::Scanner<granit_parser::input::str::StrInput>>::fetch_more_tokens
 0.1%   0.2%  28.4KiB    cargo_metadata <&mut serde_json::de::Deserializer<serde_json::read::StrRead> as serde_core::de::Deserializer>::deserialize_struct::<<cargo_metadata::Package as serde_core::de::Deserialize>::deserialize::__Visitor>
 0.1%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_42_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_42_0_edwards25519_scalarmuldouble
 0.1%   0.2%  27.2KiB              prek <<prek::config::RemoteHook as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
 0.1%   0.2%  25.9KiB              prek prek::cli::try_repo::try_repo::{closure#0}
 0.1%   0.2%  25.4KiB              prek prek::cli::update::update::{closure#0}
 0.1%   0.2%  24.9KiB               xml <xml::reader::parser::PullParser>::dispatch_token
 0.1%   0.2%  24.5KiB              prek <prek::languages::node::installer::NodeInstaller>::install::{closure#0}
 0.1%   0.2%  24.3KiB              prek <<prek::config::LocalHook as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
 0.1%   0.2%  24.0KiB     granit_parser <granit_parser::scanner::Scanner<serde_saphyr::de::buffered_input::ReaderInput>>::fetch_more_tokens
 0.1%   0.2%  23.7KiB              prek <<prek::config::UpdateOptions as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
42.3%  88.4%  12.4MiB                   And 25906 smaller methods. Use -n N to show more.
47.9% 100.0%  14.0MiB                   .text section size, the file size is 29.3MiB

Base Branch Results

 File  .text     Size             Crate Name
 1.1%   2.3% 332.0KiB        aws_lc_sys aws_lc_0_42_0_aes_gcm_encrypt_avx512
 1.1%   2.3% 332.0KiB        aws_lc_sys aws_lc_0_42_0_aes_gcm_decrypt_avx512
 0.2%   0.5%  65.4KiB              prek <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.2%   0.4%  55.1KiB              prek <<prek::config::Config as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
 0.2%   0.3%  49.4KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.3%  47.0KiB              prek prek::run::{closure#0}
 0.1%   0.3%  38.4KiB              prek prek::cli::run::run::run::{closure#0}
 0.1%   0.2%  34.3KiB              prek <prek::cli::RunOptions as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  30.1KiB     granit_parser <granit_parser::scanner::Scanner<granit_parser::input::str::StrInput>>::fetch_more_tokens
 0.1%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_42_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_42_0_edwards25519_scalarmuldouble
 0.1%   0.2%  27.2KiB              prek <<prek::config::RemoteHook as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
 0.1%   0.2%  26.2KiB              prek prek::cli::try_repo::try_repo::{closure#0}
 0.1%   0.2%  24.9KiB               xml <xml::reader::parser::PullParser>::dispatch_token
 0.1%   0.2%  24.6KiB              prek <prek::languages::node::installer::NodeInstaller>::install::{closure#0}
 0.1%   0.2%  24.3KiB              prek <<prek::config::LocalHook as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
 0.1%   0.2%  24.0KiB     granit_parser <granit_parser::scanner::Scanner<serde_saphyr::de::buffered_input::ReaderInput>>::fetch_more_tokens
 0.1%   0.2%  23.7KiB              prek <<prek::config::UpdateOptions as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
 0.1%   0.2%  22.8KiB              prek prek::archive::unzip::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
 0.1%   0.2%  22.3KiB         [Unknown] Lp384_montjscalarmul_alt_p384_montjadd
42.3%  88.4%  12.4MiB                   And 25902 smaller methods. Use -n N to show more.
47.9% 100.0%  14.0MiB                   .text section size, the file size is 29.2MiB

@prek-ci-bot

prek-ci-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

⚡️ Hyperfine Benchmarks

Summary: 0 regressions, 0 improvements above the 10% threshold.

Environment
  • OS: Linux 6.17.0-1020-azure
  • CPU: 4 cores
  • prek version: prek 0.4.10+30 (4a09cf6 2026-07-24)
  • Rust version: rustc 1.97.1 (8bab26f4f 2026-07-14)
  • Hyperfine version: hyperfine 1.20.0
CLI Commands

Benchmarking basic commands in the main repo:

prek --version

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base --version 1.8 ± 0.1 1.7 2.6 1.04 ± 0.10
prek-head --version 1.7 ± 0.1 1.6 2.6 1.00

prek list

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base list 8.1 ± 0.2 7.8 8.6 1.03 ± 0.03
prek-head list 7.9 ± 0.1 7.6 8.2 1.00

prek validate-config .pre-commit-config.yaml

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base validate-config .pre-commit-config.yaml 2.7 ± 0.1 2.6 2.9 1.03 ± 0.04
prek-head validate-config .pre-commit-config.yaml 2.7 ± 0.1 2.5 2.9 1.00

prek sample-config

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base sample-config 2.1 ± 0.1 1.9 2.2 1.01 ± 0.04
prek-head sample-config 2.1 ± 0.1 1.9 2.2 1.00
Cold vs Warm Runs

Comparing first run (cold) vs subsequent runs (warm cache):

prek run --all-files (cold - no cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 45.5 ± 1.0 44.0 47.2 1.00
prek-head run --all-files 45.6 ± 1.2 43.9 47.6 1.00 ± 0.03

prek run --all-files (warm - with cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 45.5 ± 0.9 44.0 47.6 1.00 ± 0.03
prek-head run --all-files 45.4 ± 0.9 43.4 47.0 1.00
Full Hook Suite

Running the builtin hook suite on the benchmark workspace:

prek run --all-files (full builtin hook suite)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 45.8 ± 0.6 44.7 46.9 1.00
prek-head run --all-files 46.2 ± 1.1 44.8 51.1 1.01 ± 0.03
Individual Hook Performance

Benchmarking each hook individually on the test repo:

prek run trailing-whitespace --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run trailing-whitespace --all-files 14.1 ± 0.2 13.8 14.5 1.00
prek-head run trailing-whitespace --all-files 14.1 ± 0.4 13.5 15.0 1.00 ± 0.03

prek run end-of-file-fixer --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run end-of-file-fixer --all-files 13.9 ± 0.4 13.0 14.9 1.02 ± 0.05
prek-head run end-of-file-fixer --all-files 13.7 ± 0.5 12.7 14.7 1.00

prek run check-json --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-json --all-files 5.8 ± 0.2 5.5 6.2 1.01 ± 0.05
prek-head run check-json --all-files 5.8 ± 0.2 5.5 6.3 1.00

prek run check-yaml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-yaml --all-files 5.9 ± 0.1 5.7 6.2 1.02 ± 0.04
prek-head run check-yaml --all-files 5.8 ± 0.2 5.5 6.1 1.00

prek run check-toml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-toml --all-files 5.8 ± 0.2 5.3 6.2 1.03 ± 0.05
prek-head run check-toml --all-files 5.7 ± 0.2 5.2 6.1 1.00

prek run check-xml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-xml --all-files 5.7 ± 0.2 5.4 6.0 1.01 ± 0.04
prek-head run check-xml --all-files 5.6 ± 0.2 5.3 6.0 1.00

prek run detect-private-key --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run detect-private-key --all-files 8.3 ± 0.5 7.4 9.9 1.05 ± 0.08
prek-head run detect-private-key --all-files 7.9 ± 0.4 7.4 8.6 1.00

prek run fix-byte-order-marker --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run fix-byte-order-marker --all-files 13.7 ± 0.4 13.1 14.6 1.00
prek-head run fix-byte-order-marker --all-files 13.7 ± 0.5 12.8 14.5 1.00 ± 0.04
Installation Performance

Benchmarking hook installation (fast path hooks skip Python setup):

prek install-hooks (cold - no cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base install-hooks 3.7 ± 0.1 3.7 3.8 1.00
prek-head install-hooks 3.9 ± 0.2 3.7 4.1 1.04 ± 0.05

prek install-hooks (warm - with cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base install-hooks 3.7 ± 0.1 3.6 3.8 1.02 ± 0.04
prek-head install-hooks 3.6 ± 0.1 3.6 3.9 1.00
File Filtering/Scoping Performance

Testing different file selection modes:

prek run (staged files only)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run 25.8 ± 0.4 25.0 26.4 1.01 ± 0.02
prek-head run 25.7 ± 0.4 25.2 26.6 1.00

prek run --files '*.json' (specific file type)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --files '*.json' 5.9 ± 0.1 5.7 6.1 1.02 ± 0.02
prek-head run --files '*.json' 5.8 ± 0.1 5.6 6.0 1.00
Workspace Discovery & Initialization

Benchmarking hook discovery and initialization overhead:

prek run --dry-run --all-files (measures init overhead)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --dry-run --all-files 5.3 ± 0.2 5.1 5.7 1.01 ± 0.04
prek-head run --dry-run --all-files 5.3 ± 0.1 5.1 5.4 1.00
Meta Hooks Performance

Benchmarking meta hooks separately:

prek run check-hooks-apply --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-hooks-apply --all-files 8.9 ± 0.2 8.6 9.3 1.00 ± 0.03
prek-head run check-hooks-apply --all-files 8.9 ± 0.2 8.7 9.2 1.00

prek run check-useless-excludes --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-useless-excludes --all-files 8.6 ± 0.4 8.1 9.0 1.06 ± 0.05
prek-head run check-useless-excludes --all-files 8.1 ± 0.1 7.9 8.3 1.00

prek run identity --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run identity --all-files 7.4 ± 0.1 7.3 7.6 1.00
prek-head run identity --all-files 7.5 ± 0.2 7.3 7.8 1.01 ± 0.02

@nikosavola
nikosavola force-pushed the uv-python-constraint-retry branch from 324ee60 to 4eb0dbb Compare July 24, 2026 09:08
Copilot AI review requested due to automatic review settings July 24, 2026 09:08

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4eb0dbb3af

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread crates/prek/src/languages/python/python.rs Outdated

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread crates/prek/src/languages/python/python.rs
Copilot AI review requested due to automatic review settings July 24, 2026 09:16
@nikosavola
nikosavola force-pushed the uv-python-constraint-retry branch from 4eb0dbb to c1dc7ef Compare July 24, 2026 09:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c1dc7efc01

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread crates/prek/src/languages/python/python.rs Outdated

Copilot AI 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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread crates/prek/src/languages/python/python.rs Outdated
Comment thread crates/prek/src/languages/python/python.rs Outdated
Copilot AI review requested due to automatic review settings July 24, 2026 09:48
@nikosavola
nikosavola force-pushed the uv-python-constraint-retry branch from c1dc7ef to 54a7ae3 Compare July 24, 2026 09:48

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 54a7ae32af

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread crates/prek/src/languages/python/python.rs Outdated
Copilot AI review requested due to automatic review settings July 24, 2026 09:56
@nikosavola
nikosavola force-pushed the uv-python-constraint-retry branch from 54a7ae3 to 141471d Compare July 24, 2026 09:56

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread crates/prek/src/languages/python/python.rs Outdated
Comment thread crates/prek/src/languages/python/python.rs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 141471deb6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread crates/prek/src/languages/python/python.rs Outdated
When `uv pip install` fails to resolve because the venv's Python is too old for a
(possibly transitive) dependency, parse the required Python version from uv's error,
recreate the venv with that constraint, and retry once. Closes j178#1618.
Copilot AI review requested due to automatic review settings July 24, 2026 10:15

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment on lines +250 to +253
// `request_permits` only accepts an exact-pin original when `bound` already equals it.
LanguageRequest::Python(PythonRequest::MajorMinorPatch(..)) => {
comparators = vec![format!("={bound}")];
}

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b426e2282e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

/// compatibility check against the hook's original request stays sound (e.g. against `<3.11.2`).
fn infer_python_request(stderr: &[u8]) -> Option<semver::Version> {
static PYTHON_BOUND: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"Python\s*>=?\s*(\d+\.\d+(?:\.\d+)?)").unwrap());

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 Badge Preserve strict Python lower bounds on retry

When uv reports a strict lower bound such as Python>3.10.20, this pattern matches it but only captures the version; the retry request is then built as >=3.10.20. If the failed interpreter is exactly 3.10.20 and remains discoverable, recreating the venv can succeed with the same interpreter, so the second pip install fails again instead of selecting or downloading a Python that actually satisfies the dependency.

Useful? React with 👍 / 👎.

@j178 j178 added the enhancement New feature or request label Jul 24, 2026
@j178 j178 self-assigned this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retry with inferred Python constraint on uv pip install failure

3 participants