Fetch pyproject.toml from GitHub API (#10765)

## Summary

When resolving Git metadata, we may be able to fetch the metadata from
GitHub directly in some cases. This is _way_ faster, since we don't need
to perform many Git operations and, in particular, don't need to clone
the repo.

This only works in the following cases:

- The Git repository is public. Otherwise, I believe you need an access
token, which we don't have.
- The `pyproject.toml` has static metadata.
- The `pyproject.toml` has no `tool.uv.sources`. Otherwise, we need to
lower them... And, if there are any paths or workspace sources, that
requires an install path (i.e., we need the content on-disk).
- The project is in the repo root. If it's in a subdirectory, it could
be a workspace member. And if it's a workspace member, there could be
sources defined in the workspace root. But we can't know without
fetching the workspace root -- and we need the workspace in order to
find the root...

Closes #10568.
This commit is contained in:
Charlie Marsh 2025-01-20 12:50:39 -05:00 committed by GitHub
parent b2d06f01cc
commit 5ee4cf6ff5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 254 additions and 30 deletions

View file

@ -102,7 +102,7 @@ impl GitReference {
}
/// Converts the [`GitReference`] to a `str` that can be used as a revision.
pub(crate) fn as_rev(&self) -> &str {
pub fn as_rev(&self) -> &str {
match self {
Self::Tag(rev) => rev,
Self::Branch(rev) => rev,