# Is there a function to resolve a uuid to a package name and repository?

**URL:** <https://discourse.julialang.org/t/is-there-a-function-to-resolve-a-uuid-to-a-package-name-and-repository/69143>\
**Category:** General Usage\
**Created:** [October 3, 2021, 2:55pm UTC](https://discourse.julialang.org/t/is-there-a-function-to-resolve-a-uuid-to-a-package-name-and-repository/69143 "2021-10-03T14:55:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [October 3, 2021, 2:55pm UTC](https://discourse.julialang.org/t/is-there-a-function-to-resolve-a-uuid-to-a-package-name-and-repository/69143/1 "2021-10-03T14:55:28Z")

</div>

Is there any function that given the uuid of a package resolves to its name and its git repository, default to the registry in use ?

---

<div class="post-metadata">

**Author:** ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)\
**Post date:** [October 3, 2021, 3:51pm UTC](https://discourse.julialang.org/t/is-there-a-function-to-resolve-a-uuid-to-a-package-name-and-repository/69143/2 "2021-10-03T15:51:36Z")

</div>

Maybe resolve\_versions! ([https://github.com/JuliaLang/Pkg.jl/blob/13b7861518dcfceebfc01566c329a2b2faa62623/src/Operations.jl](https://github.com/JuliaLang/Pkg.jl/blob/13b7861518dcfceebfc01566c329a2b2faa62623/src/Operations.jl)) is what you are looking for. But it looks like this function is not exported, unfortunately.

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [October 4, 2021, 7:28am UTC](https://discourse.julialang.org/t/is-there-a-function-to-resolve-a-uuid-to-a-package-name-and-repository/69143/3 "2021-10-04T07:28:32Z")

</div>

I was thinking more to something like this:

```julia
using PkgDeps
using UUIDs 

struct PkgMetadata
    uuid::UUID
    name::String
    repo::String
    registry::String
    path::String
end

function getPkgMetadata(uuid::UUID;registry_names::Array=[],depots::Union{String, Vector{String}}=Base.DEPOT_PATH)
    registries = reachable_registries(registry_names;depots=depots)
    for rego in registries
        for (pkg_name, pkg_entry) in rego.pkgs
            if pkg_entry.uuid == uuid
              return PkgMetadata(pkg_entry.uuid,pkg_entry.name,pkg_entry.repo,pkg_entry.registry_path,pkg_entry.path)
            end
        end
    end
    return PkgMetadata(uuid,missing,missing,missing,missing)
end

getPkgMetadata(uuid::String;registry_names::Array=[],depots::Union{String, Vector{String}}=Base.DEPOT_PATH) = getPkgMetadata(UUID(uuid);registry_names=registry_names,depots=depots)

myPkgData = getPkgMetadata("024491cd-cc6b-443e-8034-08ea7eb7db2b")

```

(not tested on registries other than “General”)
