2
submitted 3 days ago* (last edited 3 days ago) by dontblink@feddit.it to c/rust@lemmy.ml

In python, when you install stuff with pip, it is recommended to use a venv, to avoid breaking dependencies for a program when uninstalling another one, or when two programs need two different versions of the same dependence.

I was wondering if with Rust is the same, or if Cargo manages it all on its own (kind of like apt does), and I shouldn't care about it.

Also since I know Linux kernel is using some Rust, isn't there a risk of breaking my system if I uninstall a program that need some deps that the system itsel needs?

top 4 comments
sorted by: hot top controversial new old
[-] GissaMittJobb@lemmy.ml 2 points 22 hours ago

It's not necessary for Rust, no.

This is only a problem for Python because of a design flaw, one which Rust did not copy.

[-] jokro@feddit.org 2 points 3 days ago* (last edited 2 days ago)

Every rust project is basically it's own venv out of the box.

[-] nous@programming.dev 0 points 3 days ago

You don't need to worry about that in rust. Cargo is built from the ground up to understand package versions and downloads/builds the right versions for each project. The global package caches understand versions and can cache multiple versions of each package. Where as python just uses one or more global stores of packages shared by all projects. venv is basically there to isolated these package stores along with the version of python which can have breaking changes between different releases (this is something rust avoids at all costs so you can upgrade it without worrying as much as with python).

[-] dontblink@feddit.it 1 points 14 hours ago

My god this is so fucking clever and so fucking good to hear!!

this post was submitted on 23 Nov 2024
2 points (100.0% liked)

Rust Programming

8190 readers
20 users here now

founded 5 years ago
MODERATORS