panamax-rs / panamax

Mirror rustup and crates.io repositories, for offline Rust and cargo usage.
Apache License 2.0
427 stars 45 forks source link

Please add selective syncing #106

Open whatakey opened 1 year ago

whatakey commented 1 year ago

Panamax is a great tool, but unfortunately it doesn't allow selective syncing. the last time I used it I got more than 105GB worth of crates (and that was few months ago) while I needed only few of them, this is extremely inefficient in this use case, it would be very nice to specify crates by name or something similar to tell the tool to only download/sync those.

I'm aware of #71 but that isn't an ideal solution because you have to run cargo vendor on all of your projects, and you need to make a new project if you want newer crates. it would be nice to have selective syncing baked into panamax natively.

Thank you.

k3d3 commented 1 year ago

The big trouble with such a feature is, for any crate, you also have to discover and grab all of its dependencies. Having the user manually specify these dependencies wouldn't be a good UX, and otherwise every crate that gets downloaded would need to be extracted, read its Cargo.toml dependencies, and then recursively download them. Then you have to decide which versions of the dependent crates get downloaded; do you download them all, or just the current latest version (which might break on upgrades)?

The nice thing about using a vendor directory is that cargo effectively handles the above for you, at least to some extent.

With all that said, I'm definitely not against such a feature existing in Panamax, however I don't have the time to work on it. I'd probably accept a PR from someone willing to implement this.

k3d3 commented 1 year ago

Additionally, this project https://github.com/wcampbell0x2a/zerus might be worth looking at.

JohnEmhoff commented 1 year ago

We were able to accomplish something similar (blacklisting) by cloning the crates.io index, filtering out what we didn't want, and then pointing panamax to that filtered index when syncing. The filter itself was fairly easy to write -- maybe 100 lines of rust. I'm not sure what your precise use case is but I hope that helps.

AlexMikhalev commented 8 months ago

potential answer: cargo vendor only to grab project-related dependencies.