crates.io icon indicating copy to clipboard operation
crates.io copied to clipboard

Filter by bin/lib

Open carols10cents opened this issue 8 years ago • 10 comments

Related to, but not quite the same as #483: have a way to filter crates by those that contain binaries or are binary-only, or the opposite, that have a library component.

carols10cents avatar Jun 26 '17 15:06 carols10cents

I was looking for interesting rust binaries for a talk and I stumbled across this. Is this something that people would be keen to see? With a little support I'd like to try this 😄

felipesere avatar Jun 10 '18 21:06 felipesere

for both this one and 1904, it seems like we could modify the body and the result of uploader.rs/verify_tarball() so that it could check for naming inconsistencies (in Cargo.toml) as well as return extra information to be stored in the db (such as whether this crate contains main.rs/lib.rs or both). As meantioned in 1904, this would best be accomplished as a background job, and I was wondering what the status quo for paralel work in crates.io, process, thread or async?

smokytheangel0 avatar Nov 20 '19 00:11 smokytheangel0

We use a framework that sgrif created called swirl. Search in this repo for swirl for some example uses.

I'm not sure that verify_tarball is the right place to do this but that's because our publishing logic has gotten messy and tangled in general; not sure if we should use this opportunity as a forcing function to make us clean up or if we should throw another hack on the pile for now and clean up after.

carols10cents avatar Nov 20 '19 16:11 carols10cents

I would be honoured to help clean up now, but this is not my house so suggestions are neccessary from the team. I have alot of time to work on things, I am attempting to build experience in working with other developers so I don't make alot of n00b mistakes on my portfolio projects for my eventual applications to software companies.

smokytheangel0 avatar Nov 21 '19 20:11 smokytheangel0

FWIW we now have has_lib and bin_names columns in the database that would potentially allow us to implement a lib/bin filter for the search, if there is enough interest.

Turbo87 avatar Jul 17 '24 09:07 Turbo87

Would it be possible to support filtering baaed on binary/library crates in crates searching?

i..e. add a new query param like this https://crates.io/api/v1/crates?sort=downloads&has_binaries=true

NobodyXu avatar Sep 02 '24 04:09 NobodyXu

Motivation: I'm working on cargo-bins/cargo-quickinstall#268

Without this functionality, I will have to issue one restful API per crate for the most popular crates I got from https://crates.io/api/v1/crates?sort=downloads

NobodyXu avatar Sep 02 '24 12:09 NobodyXu

it would probably be better to work with our daily database dump instead of regularly querying the API for this information. also, whether a crate version contains a lib or bin does not change overtime, so you should only need to query the information once and then store it on your side.

Turbo87 avatar Sep 02 '24 12:09 Turbo87

Thanks!

I didn't think of that, this sounds much more efficient than using APIs.

Where can I get this db dump?

Edit:

thanks I've found it

NobodyXu avatar Sep 02 '24 13:09 NobodyXu

Just in case anyone finds their way here in the future from a search result or something, the dumps are linked from https://crates.io/data-access#database-dumps.

LawnGnome avatar Sep 04 '24 19:09 LawnGnome