Reading versions of a package from unpacked registry tarball

If you’re fine with depending on Pkg internals, this should do it:

using Pkg

function latest_version(pkgname::AbstractString)
    registry = only(filter(r -> r.name == "General", Pkg.Registry.reachable_registries()))
    pkg = only(filter(pkg -> pkg.name == pkgname, collect(values(registry.pkgs))))
    return maximum(keys(Pkg.Registry.registry_info(pkg).version_info))
end
2 Likes