panamax icon indicating copy to clipboard operation
panamax copied to clipboard

Please add selective syncing

Open whatakey opened this issue 1 year ago • 4 comments

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.

whatakey avatar Mar 31 '23 03:03 whatakey

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 avatar Mar 31 '23 23:03 k3d3

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

k3d3 avatar Mar 31 '23 23:03 k3d3

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.

JohnEmhoff avatar Jun 03 '23 22:06 JohnEmhoff

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

AlexMikhalev avatar Nov 21 '23 13:11 AlexMikhalev