Extract Julia version from the manifest

I want to start a computation using the exact same Julia version that is in the manifest on a server, where I am using juliaup. It that exact same version is not available, I prefer to throw an error.

I am unsure about the best way of extracting the version from the manifest. I can use standard Unix tools, eg as in the script

#!/bin/bash
JULIA_VERSION=`sed -n 's/julia_version\s*=\s*"\(.*\)"/\1/p' Manifest.toml`
julia +$JULIA_VERSION -t auto --project=@. run_computation.jl

or I could do it in Julia, as in

 JULIA_VERSION=`julia -e 'import TOML; print(TOML.parsefile("./Manifest.toml")["julia_version"])'`

but I am wondering if it would make sense to have a simple command line tool for this, that could perhaps look for a Manifest.toml in the parent directories too if one is not found in the current directory.

I wonder how people script this.

juliaup is working on making this automatic, such that on a juliaup-managed installation, julia would translate to julia +{what-the-manifest-says}. See Launch the manifest-specified Julia version v3 by davidanthoff · Pull Request #1095 · JuliaLang/juliaup · GitHub

3 Likes

I would love, love, LOVE this feature, but are we actually going to see this released soon? Oct 2024 was a while ago… @davidanthoff :crossed_fingers:

1 Like