RTX

March 13, 2023

I completely failed to achieve my goal of writing something non-technical at least once a month, so here we're trying not to fail with abandon. As a sad result of my WSL2 setup dying, I've had to reconfigure my desktop Linux experience from scratch again.

As a result I've run into Jeff Dickey's rtx, a software version manager written in Rust. Anyone who manages multiple projects with different sets of dependencies1 knows the pain of setting up Python environments. So far I've been using pyenv for that, which is a pretty good default.

rtx, like asdf before it, generalizes version management for software besides just Python versions, which is important when you're scared of npm (like me). Most importantly, it improves it by speeding everything up and removing shims. The entire configuration is downloading rtx, and adding the following to your .zshrc:

eval "$(rtx activate zsh)"

Here's the result:

~ ❯ rtx list
  python 3.10.10            (set by ~/.tool-versions)
  rust 1.67.1               (set by ~/.tool-versions)
~ ❯ cd ~/proj/amplify
~/proj/amplify ❯ rtx list
  python 3.10.10            (set by ~/proj/amplify/.rtx.toml)
  rust 1.67.1               (set by ~/.tool-versions)
~/proj/amplify ❯ which python
/home/singhrac/proj/amplify/.venv/bin/python

Notice the virtualenv in there? That's from moving to a directory with a .rtx.toml in it:

[tools]
python = {version = '3.10', virtualenv='.venv'}

One of the most reassuring parts of the experience is that Jeff is actively working on fixing bugs and adding features pretty much all the time.

1

Ever try testing your Pytorch code on multiple numpy/torch/Python versions? Good luck if you're not using Nox for automated testing, but even with that set up, you'll eventually need to debug some version conflict eventually.