Open oxinabox opened 4 years ago
.pkgs
is currently deprecated, but retains most of the same behaviour. We could make it a function if you like? I'm a little apprehensive of writing custom functions for processing the manifest and project dictionaries as the Pkg API hasn't been very consistent. I think I'd prefer if we added that behaviour to Pkg
for maintainability purposes.
We could make it a function if you like? Yeah, a function.
I'm a little apprehensive of writing custom functions for processing the manifest and project dictionaries as the Pkg API hasn't been very consistent. I
Your telling me: it has changed in every minor version other than 1.3 https://github.com/JuliaDiff/ChainRules.jl/pull/119/files#diff-844eb1c0a03cecbe5c3031ed6eef0f8f
In 1.4 this function one wants basically exists.
Pkg.dependencies()
help?> Pkg.dependencies
Pkg.dependencies()::Dict{UUID, PackageInfo}
│ Julia 1.4
│
│ This feature requires Julia 1.4, and is considered experimental.
Query the dependecy graph. The result is a Dict that maps a package UUID to a PackageInfo struct representing the dependency (a package).
PackageInfo fields
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
Field Description
–––––––––––– –––––––––––––––––––––––––––––––––––––––––––––––––––––––––
name The name of the package
version The version of the package (this is Nothing for stdlibs)
isdeveloped Whether a package is directly tracking a directory
ispinned Whether a package is pinned
source The directory containing the source code for that package
dependencies The dependencies of that package as a vector of UUIDs
By default it applies to the current active enviroment.
(1.4 also adds activate(f, path)
to activate an enviroment do a thing and then deactivate it, but I feel like we should be able to do Pkg.dependencies
without actually activating the enviroment?)
This is what it looks like for an fresh enviroment that I just did dev ] Embeddings#master
julia> Pkg.dependencies()
Dict{Base.UUID,Pkg.Types.PackageInfo} with 29 entries:
UUID("ea8e919c-243c-51af-8825-aaa63cd721ce") => PackageInfo("SHA", nothing, false, false, "/usr/l…
UUID("9e88b42a-f829-5b0c-bbe9-9e923198166b") => PackageInfo("Serialization", nothing, false, fals…
UUID("76f85450-5226-5b5a-8eaa-529ad045b433") => PackageInfo("LibGit2", nothing, false, false, "/u…
UUID("83e8ac13-25f8-5344-8a64-a9f2b223428f") => PackageInfo("IniFile", v"0.5.0", false, false, "/…
UUID("ade2ca70-3891-5945-98fb-dc099432e06a") => PackageInfo("Dates", nothing, false, false, "/usr…
UUID("56ddb016-857b-54e1-b83d-db4d58db5568") => PackageInfo("Logging", nothing, false, false, "/u…
UUID("c5bfea45-b7f1-5224-a596-15500f5db411") => PackageInfo("Embeddings", v"0.3.1+", false, false…
UUID("3fa0cd96-eef1-5676-8a61-b3b8758bbffb") => PackageInfo("REPL", nothing, false, false, "/usr/…
UUID("15f4f7f2-30c1-5605-9d31-71845cf9641f") => PackageInfo("AutoHashEquals", v"0.2.0", false, fa…
UUID("6462fe0b-24de-5631-8697-dd941f90decc") => PackageInfo("Sockets", nothing, false, false, "/u…
UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f") => PackageInfo("Pkg", nothing, false, false, "/usr/l…
UUID("8dfed614-e22c-5e08-85e1-65c5234f0b40") => PackageInfo("Test", nothing, false, false, "/usr/…
UUID("10745b16-79ce-11e8-11f9-7d13ad32a3b2") => PackageInfo("Statistics", nothing, false, false, …
UUID("cf7118a7-6976-5b1a-9a39-7adc72f591a4") => PackageInfo("UUIDs", nothing, false, false, "/usr…
UUID("b77e0a4c-d291-57a0-90e8-8db25a27a240") => PackageInfo("InteractiveUtils", nothing, false, f…
UUID("4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5") => PackageInfo("Unicode", nothing, false, false, "/u…
UUID("124859b0-ceae-595e-8997-d05f6a7a8dfe") => PackageInfo("DataDeps", v"0.7.0", false, false, "…
UUID("cd3eb016-35fb-5094-929b-558a96fad6f3") => PackageInfo("HTTP", v"0.8.7", false, false, "/Use…
UUID("8f399da3-3557-5675-b5ff-fb832c97cbdb") => PackageInfo("Libdl", nothing, false, false, "/usr…
UUID("739be429-bea8-5141-9913-cc70e7f3736d") => PackageInfo("MbedTLS", v"0.6.8", false, false, "/…
UUID("9a3f8284-a2c9-5f02-9a11-845980a1fd5c") => PackageInfo("Random", nothing, false, false, "/us…
UUID("2a0f44e3-6c83-55bd-87e4-b1978d98bd5f") => PackageInfo("Base64", nothing, false, false, "/us…
UUID("b99e7846-7c00-51b0-8f62-c81ae34c0232") => PackageInfo("BinaryProvider", v"0.5.8", false, fa…
UUID("2f01184e-e22b-5df5-ae63-d93ebab69eaf") => PackageInfo("SparseArrays", nothing, false, false…
UUID("8ba89e20-285c-5b6f-9357-94700520ee1b") => PackageInfo("Distributed", nothing, false, false,…
UUID("189a3867-3050-52da-a836-e630ba90ab69") => PackageInfo("Reexport", v"0.2.0", false, false, "…
UUID("37e2e46d-f89d-539d-b4ee-838fcccc9c8e") => PackageInfo("LinearAlgebra", nothing, false, fals…
UUID("de0858da-6303-5e67-8744-51eddeeeb8d7") => PackageInfo("Printf", nothing, false, false, "/us…
UUID("d6f4376e-aef5-505a-96c1-9c027394607a") => PackageInfo("Markdown", nothing, false, false, "/…
Here is the details it has for Embeddings:
julia> pinfo = Pkg.dependencies()[UUID("c5bfea45-b7f1-5224-a596-15500f5db411")];
julia> for nm in fieldnames(typeof(pinfo))
println(nm,": ", getfield(pinfo, nm))
end
name: Embeddings
version: 0.3.1+
ispinned: false
isdeveloped: false
source: /Users/oxinabox/.julia/packages/Embeddings/awjFJ
dependencies: UUID[UUID("10745b16-79ce-11e8-11f9-7d13ad32a3b2"), UUID("15f4f7f2-30c1-5605-9d31-71845cf9641f"), UUID("8dfed614-e22c-5e08-85e1-65c5234f0b40"), UUID("124859b0-ceae-595e-8997-d05f6a7a8dfe")]
The main thing that seems to be missing is which branch I add
ed.
It tells me I am not on release with the +
but doesn't tell me the branch.
Is that right @00vareladavid ?
The current iteration includes a git_revision
field which returns the branch.
I would be in favor of adding something like Pkg.dependencies("path/to/project")
in order to avoid Pkg.activate
(I think Stefan mentioned something similar).
The feature is currently marked "experimental", but I think we can declare it stable once this project depends on it. I already rewrote most of the Pkg tests to depend on this API, so it feels pretty comprehensive, but it is difficult to know what others might find confusing. I'd be happy to know about any pain points or perhaps field names which are not clear.
The most recent set of fields are here: https://github.com/JuliaLang/Pkg.jl/blob/50f9c6c7c3a7c2072914f7b1aee8a4609174f361/src/Types.jl#L1258-L1269
This is what I get for being 15 days behind the head.
@yakir12: It is not related, but I have openned a new issue for you. Am moving replies there.
Now we are storing the Manifest (#6) and we can activate it (#29) it would be nice to be able to easily get the everything out of it. Either as a list of version or as a string printed in the repl.
I only have an example for a old file, but right now it seems like the way to do it is rather complex. I think we should just have a function for this.
This is pretty good, but I think we shoukld have an easier way to get it. So that wen working out differences between results things versions can be checked.
For newer things with Manifest we woukld want to be sure the summary info showed what branch anything was on,
cc @jamblin