News for hackers. Stuff that matters.
Re:Pip and cargo are not the same by smeagull on Wednesday January 25, 2023 @10:34PM (#34527394)
I do wish more attention was paid to the ballooning disk space requirements for both.

I think Cargo is doing better, but I've yet to get a shared directory working for every build on a system. I shouldn't have to spend 2G per Rust project.

Re:Pip and cargo are not the same by beebmam on Wednesday January 25, 2023 @10:38PM (#34527411)
It's a lot more than that if you're doing cross-platform (many) builds. It's a real pain.
Re:Pip and cargo are not the same by jcelerier on Wednesday January 25, 2023 @10:58PM (#34527521)
Same with vcpkg for c++ development... Many of my students still have laptops with 128G of storage total, good luck making a whole $world fit in this when c:\Windows already uses half of it and they have their own documents & stuff
Re:Pip and cargo are not the same by kelnos on Wednesday January 25, 2023 @11:28PM (#34527688)
Yeah it seems super weird to me that cargo doesn't cache built artifacts based on crate name + version + enabled features + rustc version (and anything else that might make it unique). It seems silly that I have many built copies of the same dependency scattered across different projects on my machine.

Then again, maybe it's actually fairly rare that the things that make a crate build unique are all the same all that often, and the gains vs. complexities of caching just aren't worth it.

Re:Pip and cargo are not the same by jackosdev on Thursday January 26, 2023 @02:03AM (#34528558)
sccache works really well and there’s only two steps to install it and enable it globally, speeds up compilation time a lot as well:

https://github.com/mozilla/sccache

Re:Pip and cargo are not the same by the_duke on Thursday January 26, 2023 @03:00AM (#34528970)
sccache includes the absolute path for each compilation, so it doesn't help with caching the same dependency across different projects.
Re:Pip and cargo are not the same by jackosdev on Friday January 27, 2023 @09:52PM (#34554626)
Oh yeah, can fix that though with:

mkdir -p ~/cargo/target

export CARGO_TARGET_DIR="~/cargo/target"

Re:Pip and cargo are not the same by LoganDark on Wednesday January 25, 2023 @11:36PM (#34527718)
> I've yet to get a shared directory working for every build on a system

Same here. CARGO_TARGET_DIR exists, but that means every time I change a feature in some crate and rebuild, suddenly it doesn't match the version that all my other projects want, and I need to rebuild again when I return to those. But it is the closest thing we have.

Re:Pip and cargo are not the same by dirkg on Thursday January 26, 2023 @12:57AM (#34528152)
Nodejs solved all this years ago, now we have super fast shared package managers like pnpm, yarn etc, not to mention deno etc, why can't other languages adopt the same system?
Re:Pip and cargo are not the same by Yoric on Thursday January 26, 2023 @01:52AM (#34528479)
I assume that it is harder for Rust, because it needs to deal with `features`, with cross-compilation, with the developer using `nightly` for some projects, `stable` for others, pinned versions for yet others, etc.

That being said, harder doesn't mean unsolvable.

Re:Pip and cargo are not the same by pjmlp on Thursday January 26, 2023 @03:03AM (#34528996)
Maven and CPAN did it first, and in many ways better than node.
Re:Pip and cargo are not the same by pxc on Thursday January 26, 2023 @10:54AM (#34533313)
Node supports circular dependencies and arbitrary pre/post-install scripts, which are both disasters for downstream packaging. Node is not a model here.

The CAS that gets symlinked into vendorized directories à la pnpm is the Nix model, which is indeed an improvement that other package managers which support vendorization should incorporate.

Re:Pip and cargo are not the same by rendaw on Thursday January 26, 2023 @01:16AM (#34528253)
If it's shared, you don't know what project pulled in which dependencies so you can't clean it up. I guess this is a trade off - 2G that's easy to clean up vs ?G that isn't. The only way around would be some sort of pinning and GC like in Nix.

That said, if it's not an option, I think it'd be reasonable for people to be able to make that choice themselves...

Re:Pip and cargo are not the same by Yoric on Thursday January 26, 2023 @01:50AM (#34528467)
Could be symlinked (or hardlinked?) from a central cache, though.
Re:Pip and cargo are not the same by anewhnaccount2 on Thursday January 26, 2023 @02:17AM (#34528652)
Re:Pip and cargo are not the same by Yoric on Thursday January 26, 2023 @04:42AM (#34529644)
Which part? The caveat?
Re:Pip and cargo are not the same by anewhnaccount2 on Thursday January 26, 2023 @02:17AM (#34528646)
I use rdfind to deal with this: https://github.com/pauldreik/rdfind
Re:Pip and cargo are not the same by vlovich123 on Thursday January 26, 2023 @10:15AM (#34532647)
That tool looks fairly old considering it’s talking about sorting inodes and benchmarking on spinning disk. Is there any tool that replaces with a COW copy instead of creating a hard link? COW is strictly a safer way to do this compression and honestly it seems like something filesystems should do automatically, perhaps with FastCDC deduplication.
Re:Pip and cargo are not the same by anewhnaccount2 on Thursday January 26, 2023 @10:44AM (#34533138)
Yes, that would be safer when available (although generally files within library dependencies are not modified I think?). It looks like fclones implements this, is faster and is written in Rust https://github.com/pkolaczk/fclones (the last is the most important point of course /s).
Re:Pip and cargo are not the same by vlovich123 on Thursday January 26, 2023 @11:30AM (#34533899)
Fantastic. Now that’s a tool I’d run as it seems actually safe.

rdfind doesn’t limit itself to library dependencies so I’d be worried about it fucking up on files I’d rather not have be hardlinked just because a copy exists (eg 2 checked out git clones where modifying the code in one suddenly starts modifying files in the other)

Re:Pip and cargo are not the same by oblio on Thursday January 26, 2023 @05:54AM (#34530175)
It's absolutely ridiculous how little these package manager devs looked at Maven.

It predates almost all of them by at least half a decade, has a lot of hard thought knowledge but "Java is icky, Java is enterprise, bleh" and I can't even count how many mistakes Maven fixed back in 2005 I still see in pip, npm, cargo, etc in 2023.

Re:Pip and cargo are not the same by gladiatr72 on Thursday January 26, 2023 @06:42AM (#34530510)
Perhaps the privilege of getting sued by Oracle has something to do with it. I seem to remember Sun (then Oracle) blowing a fair bit of money on lawsuits surrounding Java.
Re:Pip and cargo are not the same by oblio on Thursday January 26, 2023 @07:18AM (#34530786)
I really doubt that a project by the Apache Software Foundation scared anyone of anything.

It would have taken these package manager devs a few days of gratis and lawsuit free research on their laptops to save millions of end users years of pain.

Re:Pip and cargo are not the same by smeagull on Sunday January 29, 2023 @11:15PM (#34575713)
My only experience of Maven was fighting it to get a single jar that included everything, and having it redownload every dependence with every single build.

I don't think downloading everything is a better solution.