How can I know the uuid of a registered package?

I wanted to know the uuid for of a registered package for using Requires.jl in Julia 0.7.

I found the uuid looking into the Package.toml file of the package in GitHub - JuliaRegistries/General: The official registry of general Julia packages

But, Is there an easy way to know the uuid of a registered package from Julia’s REPL?

Cheers,

1 Like

My understanding is that uuids are not yet generated, thus you cannot use them at the moment. You should use the old workflow.

The simples way is probably to add Package and then look in Project.toml. In the future you can just look in the packages Project.toml.

Using the github file finder makes it pretty quick:

But I was also looking for a command to shorten that step further, like:

(v0.7) pkg> uuid Requires
6 Likes

This might be useful (returns a string, from your local copy of the registry), if you don’t mind depending on internals that may change:

function registereduuid(name)
    initial = SubString(name, 1:1)
    for d in Pkg.Types.registries()
        r = joinpath(d, initial, name, "Package.toml")
        if isfile(r)
            p = Pkg.TOML.parsefile(r)
            return get(p, "uuid", nothing)
        end
    end
    nothing
end
2 Likes

it would be good to get something like that into Pkg.jl so they can deal with those changing internals at the source

Check the UUID in ~/.julia/environments/1.0/Manifest.toml, any package or dependency you added should show up here.

Hmm, well I could add this feature to my pull request for the Pkg search, which can already find lots of info about packages. It already does the opposite, such as telling you the name of a package given a UUID.

3 Likes

That would be great. Manifest.toml doesn’t contain packages that aren’t on your system, so isn’t the complete solution - especially because Requires specifies which packages you don’t need in your system!