Skip to content

refactor/docs: improve compile_pip_requirements error message and docs #2792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 23, 2025

Conversation

brandonchinn178
Copy link
Contributor

@brandonchinn178 brandonchinn178 commented Apr 20, 2025

Resolution failure is the most common error from pip-compile, so we should make sure the error message is as clean as it can be. Previously, the output was cluttered with the exception traceback, which makes the actual error hard to see (several nested traceback).

The new output shortens it with a nicer message:

Checking _main/requirements_lock.txt
  ERROR: Cannot install requests<2.24 and requests~=2.25.1 because these package versions have conflicting dependencies.
ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

Fixes #2763

Copy link
Collaborator

@rickeylev rickeylev left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to improve the error messaging!

Just a quick partial review.

Copy link
Collaborator

@dougthor42 dougthor42 left a comment

Choose a reason for hiding this comment

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

LGTM, no blockers on my end. I'll let @rickeylev decide when to add to the merge queue.

Thanks!

Comment on lines +239 to +240
else:
raise
Copy link
Collaborator

Choose a reason for hiding this comment

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

Super nit: the sys.exit will mean you don't reach L239 so you don't actually need the else

except ...:
  if ...:
      sys.exit(1)
  raise

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure; I like being explicit 🙂

@rickeylev rickeylev changed the title Improve compile_pip_requirements errors and docs refactor/docs: improve compile_pip_requirements error message and docs Apr 22, 2025
@rickeylev
Copy link
Collaborator

LGTM

FYI: Avoid force-pushing during PR review. What happens is comments get "lost" -- one can see them on the "conversation" pane, but can't actually access them in the "review" pane. It also clobbers the history of changes, which makes it harder to see what was changed in between review.

@rickeylev rickeylev enabled auto-merge April 22, 2025 21:22
@brandonchinn178
Copy link
Contributor Author

@rickeylev Not sure what the build failure is, pretty sure it's ephemeral?

@rickeylev
Copy link
Collaborator

Yeah, looks like a temporary network error. I updated this head, so CI is running again and it's back in the merge queue.

@rickeylev rickeylev added this pull request to the merge queue Apr 23, 2025
Merged via the queue into bazel-contrib:main with commit e32b08f Apr 23, 2025
3 checks passed
@brandonchinn178 brandonchinn178 deleted the compile-pip branch April 24, 2025 02:29
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.

compile_pip_requirements should be robust against upstream wheel breakages
3 participants