
Python pro to Rust rookie — a knowledge scientist’s transition tale

Embarking on the journey from Python to Rust can feel like swapping a trusty lightsaber for a brand new sort of blade — exciting but a bit daunting. As a knowledge scientist deeply conversant in Python’s quirks, diving into the Rust world is an exhilarating recent challenge. In this text, I’ll share my experiences and insights, comparing how these two powerful languages handle a key aspect of software development — particularly specializing in (virtual) environments and dependency management.
When using Python, one among the primary stuff you learn is to work in so called virtual environments. It is a vital tool for managing dependencies and isolating project-specific packages such that they don’t interfere with other projects or the system-wide Python installation. I wrote an article on how I manage Python a couple of years ago nevertheless it continues to be relevant (it modified a bit with micromamba and poetry, let me know if I should write an article about that).
TLDR: Just use cargo and also you can be high-quality more often than not — Dennis
After installing Rust using rustup, my first query was: how should I create a virtual environment? To me this can be a very sensible query as Rust can also use many packages (called Crates) as dependencies. The reality is that cargo solves this problem very elegantly. Below are my findings in comparing virtual environments and pip to the Rust’s cargo construct system.
Disclaimer: As I navigate these Rustic landscapes, my proficiency with the language should be a bit Rusty (pun intended). Join me on this learning adventure as we unravel the nuances of Cargo and bid farewell to the familiar embrace of virtual environments.
Virtual environments in Python are created with tools like venv, virtualenv, or conda on a per-project basis. Under the hood, these systems create a separate folder which holds the Python distribution and all its packages. Now, after we install a package with pip or conda, the package and all its dependencies are installed on this isolated folder. These virtual environment tools do…