Introducing zv: A blazing fast zig version manager / project starter

Introducing zv: A fast Zig version manager written in Rust :crab::high_voltage:

Tired of juggling Zig versions? I built zv to make installing/switching between Zig toolchains effortless. Regardless of your platform.

Key features:

  • Project-aware versioning - Just add .zigversion to your repo and zv automatically uses the right version
  • Flexible version syntax - zv use 0.13.0 for stable, zv use master for latest dev, or zig +0.14.0 build to run commands with a specific version. This is made possible because I adopted rustup’s proxy system for zv.
  • Smart cleanup - zv rm --except 0.13.0,master to free up space while keeping what you need

Multiple architectures - Your shell/platform is auto-detected.
Status: Alpha but stable! I’ve tested most core features and they work great and working great. ZLS support coming soon :rocket:

Install via cargo: cargo install zv (latest 0.1.1)
Then run zv setup -d to preview changes (creates an env file & adds ZV_DIR/bin to PATH)
Then after you’ve verified the changes run zv setup to install zv @ ZV_DIR/bin by default $HOME/.zv

finally uninstall the cargo binary: cargo uninstall zv

you should now be able to run zv or zig after installing a version zv use latest.
GitHub: GitHub - weezy20/zv: Blazing fast zig version manager & developer toolkit

Would love feedback from the Zig community! What features would you find most useful?

2 Likes

I think anyzig got it right.

8 Likes

Nice to see a similar thing. I prefix the version with + following rustup’s style. About the minimum_zig_version from build.zig/build.zig.zon it shouldn’t be too hard to implement it before 1.0.0. Thanks for the feedback!

Hi @zv2 , welcome to ziggit. The people in here and through out zig communities are generally pretty down to earth. We don’t care to be marketed to. Saying things like ā€œBlazing Fastā€ are big red flags, especially when there is no accompanying benchmark data.

Instead, just be genuine, and direct. Just tell people what you’ve worked on and some things you might be proud of about it.

I don’t say this as a reprimand, but as a kind word to help you assimilate to a new community.

9 Likes

It would be ideal to have something like ./zigw in the root of the repository (similar to ./gradlew). Just run ./zigw and don’t worry about version, mirrors, how it was downloaded or cached and never rely on garbage in your PATH.

Tigerbeetle does almost the same

Got it, thanks for pointing that out :folded_hands: — I should clarify that the ā€˜blazing fast’ bit was meant tongue-in-cheek, since that phrase is often jokingly used with Rust projects. What it actually does is pretty straightforward: download + verification + extraction, using the best native Rust crates I could find for the ecosystem. I’ll keep it more direct going forward :+1:

2 Likes

Having to install the complete Rust toolchain first before getting a Zig tool is a bit weird tbh :wink:

It’s a chicken-egg-problem of course but I prefer zvm’s installation shell-one-liner to pull a pre-compiled binary (see: GitHub - tristanisham/zvm: zvm (Zig Version Manager) lets you easily install/upgrade between different versions of Zig.).

From then on zvm can update itself.

Integration with homebrew, scoop, apk etc… would be even better than running a shell script which downloads an ā€˜untrusted’ binary of course, but that’s also a lot more hassle on the tool author’s side.

2 Likes

I feel you and that’s why this is alpha software. I’ve contemplated both one liner shell-scripts that would fetch some popular binaries generated via CI or integration with some package managers like scoop, choco, apt & pacman but this would come after I reach full feature compatibility (zv update & zls support).

1 Like

Feel the same, and you know, software that builds software - like Zig - are high-value targets for supply chain attacks.

If I were to use a versioning system for a compiler (I’m personally not), then I want to understand it fully and it must be easy to see what has changed when the version manager is upgraded.

This is asking me to get confident with a surprisingly large amount non-Zig code for a Zig version manager, including a whopping 35 direct dependencies (a grand total of 116 crates were downloaded)

7 Likes

That’s a pretty respectable take.