Add pypi 10k packages with most dependents dataset (#711)

From manual inspection, this dataset generated through the [libraries.io
API](https://libraries.io/api#project-search) seems more mainstream than
the current 8k one, which is also preserved. I've added the dataset to
the repo because the API requires an API key.
This commit is contained in:
konsti 2023-12-24 19:31:52 +01:00 committed by GitHub
parent 5bce699ee1
commit e23292641f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 315 additions and 23 deletions

View file

@ -41,13 +41,29 @@ impl<'a> RegistryWheelIndex<'a> {
&mut self,
name: &PackageName,
) -> impl Iterator<Item = (&Version, &CachedRegistryDist)> {
self.get_impl(name).iter().rev()
}
/// Get the best wheel for the given package name and version.
///
/// If the package is not yet indexed, this will index the package by reading from the cache.
pub fn get_version(
&mut self,
name: &PackageName,
version: &Version,
) -> Option<&CachedRegistryDist> {
self.get_impl(name).get(version)
}
/// Get an entry in the index.
fn get_impl(&mut self, name: &PackageName) -> &BTreeMap<Version, CachedRegistryDist> {
let versions = match self.index.entry(name.clone()) {
Entry::Occupied(entry) => entry.into_mut(),
Entry::Vacant(entry) => {
entry.insert(Self::index(name, self.cache, self.tags, self.index_urls))
}
};
versions.iter().rev()
versions
}
/// Add a package to the index by reading from the cache.