diff --git a/crates/uv-distribution/src/distribution_database.rs b/crates/uv-distribution/src/distribution_database.rs index f55d228c2..124940c0d 100644 --- a/crates/uv-distribution/src/distribution_database.rs +++ b/crates/uv-distribution/src/distribution_database.rs @@ -10,7 +10,7 @@ use tempfile::TempDir; use tokio::io::{AsyncRead, AsyncSeekExt, ReadBuf}; use tokio::sync::Semaphore; use tokio_util::compat::FuturesAsyncReadCompatExt; -use tracing::{Instrument, info_span, instrument, warn}; +use tracing::{Instrument, info_span, instrument, warn, debug}; use url::Url; use uv_auth::PyxTokenStore; use uv_cache::{ArchiveId, CacheBucket, CacheEntry, WheelCache}; @@ -377,29 +377,24 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { hashes: HashPolicy<'_>, ) -> Result { // If this is a Git distribution, look for cached wheels. - // TODO(charlie): What if this is unnamed? How can we infer the package name? Maybe we make - // the whole thing content-addressed, and assume that the registry contains at most one - // package? - if let BuildableSource::Dist(SourceDist::Git(dist)) = dist { + if let SourceDist::Git(dist) = dist { if dist.subdirectory.is_none() { if let Some(repo) = GitHubRepository::parse(dist.git.repository()) { if let Ok(store) = PyxTokenStore::from_settings() { - let url = store.api().join(&format!("v1/git/astral-sh/{}/{}", repo.owner, repo.repo)).unwrap(); + // let url = store.api().join(&format!("v1/git/astral-sh/{}/{}", repo.owner, repo.repo)).unwrap(); + let url = VerbatimUrl::parse_url(&format!("http://localhost:8000/v1/git/astral-sh/{}/{}", repo.owner, repo.repo)).unwrap(); let index = IndexMetadata { - url: IndexUrl::from(VerbatimUrl::from(url)), + // url: IndexUrl::from(VerbatimUrl::from(url)), + url: IndexUrl::from(url.clone()), format: IndexFormat::Simple, }; let archives = self.client - .managed(|client| { + .manual(|client, semaphore| { client.package_metadata( - dist.name(), Some(index.as_ref()), self.build_context.capabilities(), self.build_context + dist.name(), Some(index.as_ref()), self.build_context.capabilities(), semaphore, ) }) - .await - .map_err(|err| match err { - CachedClientError::Callback { err, .. } => err, - CachedClientError::Client { err, .. } => Error::Client(err), - })?; + .await?; // TODO(charlie): This needs to prefer wheels to sdists (but allow sdists), // etc., filter by tags, filter by `requires-python`, etc. @@ -412,6 +407,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { .expect("archived version files always deserializes"); for (filename, file) in files.all() { if let DistFilename::WheelFilename(filename) = filename { + debug!("Found cached wheel {filename} for Git distribution: {dist}"); let dist = BuiltDist::Registry(RegistryBuiltDist { wheels: vec![ RegistryBuiltWheel { @@ -597,25 +593,26 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { // the whole thing content-addressed, and assume that the registry contains at most one // package? if let BuildableSource::Dist(SourceDist::Git(dist)) = source { + // TODO(charlie): Make this more efficient. + self.builder.resolve_revision(source, &self.client).await?; + if dist.subdirectory.is_none() { if let Some(repo) = GitHubRepository::parse(dist.git.repository()) { if let Ok(store) = PyxTokenStore::from_settings() { - let url = store.api().join(&format!("v1/git/astral-sh/{}/{}", repo.owner, repo.repo)).unwrap(); + // let url = store.api().join(&format!("v1/git/astral-sh/{}/{}", repo.owner, repo.repo)).unwrap(); + let url = VerbatimUrl::parse_url(&format!("http://localhost:8000/v1/git/astral-sh/{}/{}", repo.owner, repo.repo)).unwrap(); let index = IndexMetadata { - url: IndexUrl::from(VerbatimUrl::from(url)), + // url: IndexUrl::from(VerbatimUrl::from(url)), + url: IndexUrl::from(url.clone()), format: IndexFormat::Simple, }; let archives = self.client - .managed(|client| { + .manual(|client, semaphore| { client.package_metadata( - dist.name(), Some(index.as_ref()), self.build_context.capabilities(), self.build_context + dist.name(), Some(index.as_ref()), self.build_context.capabilities(),semaphore ) }) - .await - .map_err(|err| match err { - CachedClientError::Callback { err, .. } => err, - CachedClientError::Client { err, .. } => Error::Client(err), - })?; + .await?; // TODO(charlie): This needs to prefer wheels to sdists (but allow sdists), // etc. @@ -628,6 +625,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { .expect("archived version files always deserializes"); for (filename, file) in files.all() { if let DistFilename::WheelFilename(filename) = filename { + debug!("Found cached wheel {filename} for Git distribution: {dist}"); let dist = BuiltDist::Registry(RegistryBuiltDist { wheels: vec![ RegistryBuiltWheel { diff --git a/crates/uv-git/src/resolver.rs b/crates/uv-git/src/resolver.rs index 70593ed73..f00bab463 100644 --- a/crates/uv-git/src/resolver.rs +++ b/crates/uv-git/src/resolver.rs @@ -213,6 +213,7 @@ impl GitResolver { /// [`resolve_precise`], and will return `None` for URLs that have not been resolved _or_ /// already have a precise reference. pub fn precise(&self, url: GitUrl) -> Option { + println!("Resolving precise Git URL for: {url}"); let reference = RepositoryReference::from(&url); let precise = self.get(&reference)?; Some(url.with_precise(*precise)) diff --git a/foo/.python-version b/foo/.python-version new file mode 100644 index 000000000..f982feb41 --- /dev/null +++ b/foo/.python-version @@ -0,0 +1 @@ +3.14.0 diff --git a/foo/README.md b/foo/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/foo/main.py b/foo/main.py new file mode 100644 index 000000000..f8a203dd4 --- /dev/null +++ b/foo/main.py @@ -0,0 +1,6 @@ +def main(): + print("Hello from foo!") + + +if __name__ == "__main__": + main() diff --git a/foo/pyproject.toml b/foo/pyproject.toml new file mode 100644 index 000000000..99b37a1ba --- /dev/null +++ b/foo/pyproject.toml @@ -0,0 +1,10 @@ +[project] +name = "foo" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.14.0" +dependencies = ["anyio"] + +[tool.uv.sources] +anyio = { git = "https://github.com/agronholm/anyio", rev = "64b753b19c9a49e3ae395cde457cf82d51f7e999" } diff --git a/foo/uv.lock b/foo/uv.lock new file mode 100644 index 000000000..12356e53d --- /dev/null +++ b/foo/uv.lock @@ -0,0 +1,31 @@ +version = 1 +revision = 3 +requires-python = ">=3.14.0" + +[[package]] +name = "anyio" +version = "4.11.0.post24" +source = { git = "https://github.com/agronholm/anyio?rev=64b753b19c9a49e3ae395cde457cf82d51f7e999#64b753b19c9a49e3ae395cde457cf82d51f7e999" } +dependencies = [ + { name = "idna" }, +] + +[[package]] +name = "foo" +version = "0.1.0" +source = { virtual = "." } +dependencies = [ + { name = "anyio" }, +] + +[package.metadata] +requires-dist = [{ name = "anyio", git = "https://github.com/agronholm/anyio?rev=64b753b19c9a49e3ae395cde457cf82d51f7e999" }] + +[[package]] +name = "idna" +version = "3.11" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902", size = 194582, upload-time = "2025-10-12T14:55:20.501Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea", size = 71008, upload-time = "2025-10-12T14:55:18.883Z" }, +] diff --git a/server/v1/git/astral-sh/agronholm/anyio/anyio/anyio-4.11.0.post24-py3-none-any.whl b/server/v1/git/astral-sh/agronholm/anyio/anyio/anyio-4.11.0.post24-py3-none-any.whl new file mode 100644 index 000000000..5f63bfdf8 Binary files /dev/null and b/server/v1/git/astral-sh/agronholm/anyio/anyio/anyio-4.11.0.post24-py3-none-any.whl differ diff --git a/server/v1/git/astral-sh/agronholm/anyio/anyio/anyio-4.11.0.post24.tar.gz b/server/v1/git/astral-sh/agronholm/anyio/anyio/anyio-4.11.0.post24.tar.gz new file mode 100644 index 000000000..01f49c80a Binary files /dev/null and b/server/v1/git/astral-sh/agronholm/anyio/anyio/anyio-4.11.0.post24.tar.gz differ diff --git a/server/v1/git/astral-sh/agronholm/anyio/anyio/index.html b/server/v1/git/astral-sh/agronholm/anyio/anyio/index.html new file mode 100644 index 000000000..599de154b --- /dev/null +++ b/server/v1/git/astral-sh/agronholm/anyio/anyio/index.html @@ -0,0 +1,12 @@ + + + + + Links for anyio + + +

Links for anyio

+ anyio-4.11.0.post24-py3-none-any.whl
+ anyio-4.11.0.post24.tar.gz
+ + diff --git a/server/v1/git/astral-sh/agronholm/anyio/index.html b/server/v1/git/astral-sh/agronholm/anyio/index.html new file mode 100644 index 000000000..16b4e5eae --- /dev/null +++ b/server/v1/git/astral-sh/agronholm/anyio/index.html @@ -0,0 +1,11 @@ + + + + + Links for anyio + + +

Links for anyio

+ anyio
+ +