It’s easy to get developers excited to try Ruby on Rails, with its productivity, speed and efficiency … but, then comes the time it takes to set it up. “If you have a $5 a month droplet on Digital Ocean, it will probably take you 40 minutes to compile a new Ruby version from source for your droplet,” said André Arko, co-creator of Bundler for Ruby and author of The Ruby Way, third edition.
Arko added that downloads are only required at install and then when the language updates, but the download time is off-putting for new developers.
“Then they say, Wait, what?” Arko said. “It only happens once a month or once a quarter, but if you’re new to Ruby, that’s still your entire impression of the language, and that really sucks.”
Arko has developed RV, a new Rust-based tool that solves this problem.
The Problem With Dependencies
Arko first learned Ruby back in the early 2000s. He went on to create Bundler for Ruby on Rails. Until Bundler, there were no package managers. Python had Pip as a package installer; Perl had CPAN as the package installer to install Perl packages.
But there wasn’t a dependency manager that would allow developers to list every package that a project needs, in one place. Arko once spent an entire week hunting down a bug that only appeared on one of three production servers. The issue was a single, different version of a dependency.
To solve this, Arko, Carl Lerche and Yehuda Katz created Bundler, a dependency manager that introduced the concept of a lock file. This file “locks down” the exact versions of all packages and their dependencies, guaranteeing that every developer and every server gets the same code.
“It’s like a manifest of the exact version of every package, guaranteeing that they all work together,” Arko explained.
The concept of a lock file is now a gold standard in modern software development, but Arko, who still maintains Bundler, started to notice new innovations emerging from other languages.
“When I was making Bundler, I was like, Oh, we are coming up with the new innovations,” he said. “And then, as I maintained Bundler over time, I was fixing bugs, and somebody else was off coming up with new innovations for Node or new innovations for Rust or new innovations for Python.”
RV’s Inspiration: Python’s UV
Around 2015, Arko had the idea of a language manager that would be a new kind of dependency manager — he didn’t have a name for it because there was only Astral’s UV as an example of what he meant.
“The specific things that it does is it combines what we usually call a version manager — which manages the language itself, Python, Ruby, Rust, whatever — and then it also folds in the dependency manager.”
He was particularly inspired by UV, a modern Python package and project manager written in Rust. What sets UV apart is its speed and its ability to combine two traditionally separate tools: a version manager (which manages the language itself) and a dependency manager.
“It only happens once a month or once a quarter, but if you’re new to Ruby, that’s still your entire impression of the language, and that really sucks.”
– André Arko, creator of RV
For most languages, those tasks are managed by different tools. For instance, Rust has Rustup as the version manager and Cargo as the dependency manager. In Ruby, a developer needs one of three version managers (RVM, rbenv, or asdf) and a separate dependency manager (Bundler). UV’s innovation was to combine these functions into one tool, making the entire process faster and more streamlined.
“UV invented this breakthrough of ‘We’re going to jam both of them together,’ which is going to unlock new things that were never possible to do before, and we’re going to make it incredibly fast,’” he said.
The version of UV 0.3 that did this innovative combination first came out approximately one year ago, he noted. Arko used the tool with his Python project and then missed it when he worked on Ruby.
“It’s so fast and it’s so useful, that during the last year, every time I’ve come back to Ruby, which is still where I spend the majority of my time, I feel frustrated that I don’t have UV available to me,” he said. In the meantime, he waited for someone else to build a tool that would bring that function to Ruby.
The Problem With Ruby
The inspiration for a combined version and dependency manager for Ruby converged with a new professional opportunity. Arko and other open source maintainers formed a collective called Spinel.coop, a consultancy that helps companies with technical problems. They needed a project to showcase their expertise, and Arko realized he could build the tool he had been dreaming of for a decade.
“Basically, these two ideas came together for me at the same time,” he said. “Basically, with the inspiration of UV, I suddenly had a reason to build a version manager, to add to a dependency manager, to create this new category of tool.”
The idea further crystallized this past July when he attended RailsConf in Philadelphia.
“I hadn’t been sure that I was going to sit down and start working on it until I was talking to other developers at RailsConf,” he said. “I basically said, ‘What do you think about this idea?’”
What he learned is that developers consistently had the problem of convincing developers to try Ruby on Rails, but then when they find out they need to wait 10 to 40 minutes to download everything so it can compile and execute, they’re turned off by the language.
“All of the Ruby version management status quo today takes seven to 40 minutes to install a new Ruby version,” Arko said. “And every time I upgrade my Ruby, I get kind of sad and frustrated knowing that it could be faster than this.”
He started to build RV.
RV Installs Ruby in Seconds
RV is still very young but out of the gate with version 0.1.1, it solve the download barrier problem and that’s already garnering attentions, Arko said.
“… every time I upgrade my Ruby, I get kind of sad and frustrated knowing that it could be faster than this.”
– André Arko
Previously, on a high-end development desktop workstation, that would have taken six or seven minutes and up to 40 minutes as a droplet on Digital Ocean. That’s because Ruby version managers have had to install a ‘tarball of source code,” Arko said, that is downloaded to your machine and then it literally starts compiling that source code from scratch.
“That is what takes so long, is that every developer in the entire world is rebuilding Ruby, just for their own personal machine every time there’s a new version,” Arko said.
But it’s possible to ask GitHub Actions, CircleCI or other CI/CD systems to build Ruby and provide the finished product. RV takes the finished product, then downloads the executable and installs it instead of that tarball of source code. RV act as an intermediary, so rather than asking every user to do it individually, RV does it once in advance, turning the source code into a binary. It then installs a functional Ruby interpreter on your Linux or Mac machine very quickly. Rust also gives it a boost.
“Because Rust is very fast at downloading and installing things, it takes about one second,” he said.
What’s Next for RV
RV is a work in progress, Arko cautioned.
“We have not delivered on the overarching promises of UV yet,” Arko said. “We have released the very first possible version of RV, which to be completely clear is actually just a stripped down version manager — all that we have actually shipped so far is the version management portion of the tool.”
But in the roadmap is the dependency management portion of the tool and the higher-level combination tool that will merge version management with dependency management — a tool he doesn’t yet have a name for — are on the roadmap.
“To be clear, this is imaginary because we haven’t written it yet, but conceptually, you can say RV run Rails new, and you don’t even need to have Ruby installed. RV will install the Ruby that you need in one second, and then RV will install the Rails that you need in another second, … and one or two seconds later, Rails is now running, and that was all you needed to do,” he said.
In the meantime, he’d love to get developer feedback about that goal.
“I would just like to make using Ruby easy and straightforward and great and awesome from the company perspective,” he said. “I would love to talk to companies who want all of their developers to be faster at using Ruby and more efficient and know what they’re doing and solve their problems.”
YOUTUBE.COM/THENEWSTACK
Tech moves fast, don’t miss an episode. Subscribe to our YouTube
channel to stream all our podcasts, interviews, demos, and more.