Skip to content

Only require setuptools when an initial attempt fails#270

Merged
bradhe merged 4 commits intodevelopfrom
fixes/setuptools-workaround
Apr 27, 2026
Merged

Only require setuptools when an initial attempt fails#270
bradhe merged 4 commits intodevelopfrom
fixes/setuptools-workaround

Conversation

@bradhe
Copy link
Copy Markdown
Contributor

@bradhe bradhe commented Apr 27, 2026

We had some overly-aggressive logic that tried to resolve a known issue with setuptools in the Python ecosystem. This PR makes that slightly more efficient in the default case with a reasonable fallback when something goes wrong.

@bradhe bradhe requested a review from socksy April 27, 2026 13:44
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 122aff8e-1e77-4f78-b6a1-439ca952fe47

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fixes/setuptools-workaround

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread crates/tower-uv/src/lib.rs Outdated
Comment thread crates/tower-uv/src/lib.rs Outdated
//
// https://github.com/pypa/setuptools/issues/5174
let unpinned_resolves = {
let mut probe = Command::new(&self.uv_path);
Copy link
Copy Markdown
Contributor

@sammuti sammuti Apr 27, 2026

Choose a reason for hiding this comment

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

Actually this solution disguises possibly a major latency increase for the happy path when the user app does not pin setuptools in requirements.txt it seems as there is an additional round trip to pypi to resolve

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is typically really fast; however, I generally agree that we have to go to PyPI twice. Do you have another suggestion for how we can do this with only one round trip?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think I have a solution actually. One sec.

return Err(e.into());
}
Ok(mut retry_child) => {
let stdout = retry_child.stdout.take().expect("no stdout");
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.

could probably take this whole bit out into its own helper function now, but not a blocker

Comment on lines +367 to +373
/// Returns whether a failed `sync()` for this directory is eligible for a
/// retry via [`sync_with_legacy_setuptools_pin`]. Only applies to projects
/// driven by `requirements.txt`; pyproject-based projects manage their own
/// setuptools dependency.
pub fn should_use_legacy_setuptools_pin(&self, cwd: &Path) -> bool {
cwd.join("requirements.txt").exists()
}
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.

I think if we're doing the retesting method we have no reason to differentiate

@bradhe bradhe merged commit 16eb47f into develop Apr 27, 2026
31 checks passed
@bradhe bradhe deleted the fixes/setuptools-workaround branch April 27, 2026 15:47
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.

3 participants