Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crawl registry (→ to rm restriction "Only works for pkgs in active project") #5

Closed
tfiers opened this issue Dec 9, 2022 · 8 comments
Labels
feature An enhancement to src/ visible to end-users
Milestone

Comments

@tfiers
Copy link
Owner

tfiers commented Dec 9, 2022

exploration:

using Pkg

reg = Pkg.Registry.reachable_registries()[1]  # (first, and only, for me. the General)
pkgentry = values(reg.pkgs)[1]
p = Pkg.Registry.init_package_info!(pkgentry)

p.repo  # → https github url, to make svg dot nodes clickable :)
# in tooltip of svg dot nodes could go version or sth, mayb
p.deps  # weird format: map of versionrange (of what?) => set of deps (organized as name=>UUID map)
p.version_info  # useful ye. `first(keys(_))` is latest version i suppose

(from https://github.com/tfiers/julia-sketches, pkgdepgraph-v2)

@tfiers tfiers added the feature An enhancement to src/ visible to end-users label Dec 9, 2022
@tfiers
Copy link
Owner Author

tfiers commented Dec 26, 2022

Do @infos: "Package found in active project, so we can use 'Manifest.toml'", stuff like that.
mayb if gathering deps (repeatedly calling that init_pkg_info!) is slow, then a line for each or sth

@tfiers tfiers added this to the v0.2 milestone Dec 26, 2022
@tfiers
Copy link
Owner Author

tfiers commented Dec 27, 2022

First q: how to get uuid of pkg

ah, prob look at PkgDeps etc here

@tfiers tfiers changed the title Allow packages not installed in active project Crawl registry (Remove restriction "only pkgs in active project") Dec 28, 2022
@tfiers tfiers changed the title Crawl registry (Remove restriction "only pkgs in active project") Crawl registry (→ to rm restriction "Only works for pkgs in active project") Dec 29, 2022
@tfiers
Copy link
Owner Author

tfiers commented Jan 5, 2023

https://github.com/JuliaEcosystem/PkgDeps.jl

https://github.com/JuliaEcosystem/PkgDeps.jl/blob/a568954/src/utilities.jl#L105:

  • registry.pkgs[pkg_name].uuid

from https://github.com/JuliaEcosystem/PkgDeps.jl/blob/a568954/src/registry_instance.jl#L11

    d = parsefile(joinpath(path, "Registry.toml"))
    pkgs = Dict{AbstractString, PkgEntry}()

    for (uuid, info) in d["packages"]
        uuid = UUID(uuid)
        name = info["name"]
		

@tfiers
Copy link
Owner Author

tfiers commented Jan 5, 2023

Pkg.Registry.reachable_registries()

so, their reachable_registries() (https://github.com/JuliaEcosystem/PkgDeps.jl/blob/a568954/src/PkgDeps.jl#L71) is not necessary. merged in base mayb.
mayb is necessary for 1.6

@tfiers
Copy link
Owner Author

tfiers commented Jan 5, 2023

hm, reg = only(Pkg.Registry.reachable_registries()) has a field name_to_uuids...
it's empty at start. there must be a fillin func somewhere

@tfiers
Copy link
Owner Author

tfiers commented Jan 5, 2023

just googled it, hah.
https://github.com/JuliaLang/Pkg.jl/blob/5ae866151e0cfd0536d0bfbb66e7f14ea026bd31/src/Registry/registry_instance.jl#L367-L370

function uuids_from_name(r::RegistryInstance, name::String)
    create_name_uuid_mapping!(r)
    return get(Vector{UUID}, r.name_to_uuids, name)
end

@tfiers
Copy link
Owner Author

tfiers commented Jan 8, 2023

Two files (both used by depgraph.jl):

  • manifest.jl
  • registry.jl

@tfiers
Copy link
Owner Author

tfiers commented Jan 15, 2023

This added a quirk: registry and Manifest may order packages differently, and that means dot renders something different:
with mani:

with registry:

(At least I think that's the reason for the difference)

This might cause user confusion.
Should be helped if "generated from [proj path]" or "generated from General registry" is in the

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature An enhancement to src/ visible to end-users
Projects
None yet
Development

No branches or pull requests

1 participant