JuliaLang / Pkg.jl

Pkg - Package manager for the Julia programming language
https://pkgdocs.julialang.org
Other
609 stars 251 forks source link

Use historical stdlib dependency information #3911

Open staticfloat opened 4 weeks ago

staticfloat commented 4 weeks ago

This makes use of the new functionality in HistoricalStdlibVersions [0] to properly pull out the dependency information in old stdlibs. This fixes https://github.com/JuliaPackaging/HistoricalStdlibVersions.jl/issues/9.

[0] https://github.com/JuliaPackaging/HistoricalStdlibVersions.jl/pull/23

staticfloat commented 4 weeks ago

One point of contention here; the Pkg.Types.stdlibs() function seems to be [used in the ecosystem](https://juliahub.com/ui/Search?q=Pkg.Types.stdlibs()&type=code), but I like the StdlibInfo struct a lot more than just a random tuple. Should I maintain backwards compatibility, or do we just require package authors to do something like:

if isdefined(Pkg.Types, :StdlibInfo)
    stdlib_names = [info.name for (uuid, info) in Pkg.Types.stdlibs()]
else
    stdlib_names = [name for (uuid, (name, version)) in Pkg.Types.stdlibs()]
end
staticfloat commented 4 weeks ago

@KristofferC If you are happy with this, I will make a breaking v2.0.0 release of HistoricalStdlibVersions, register that, then drop the commit here that manually installs that branch. (Kudos on the [sources] section, super convenient!)

DilumAluthge commented 4 weeks ago

Just to double-check: the Pkg.Types.stdlibs() function is not currently public, right? So in theory we are allowed to make whatever breaking changes we want?

the Pkg.Types.stdlibs() function seems to be [used in the ecosystem](https://juliahub.com/ui/Search?q=Pkg.Types.stdlibs()&type=code),

Skimming that list, it looks like I'm responsible for 4 out of 7 of the usages. I'd be fine with doing a breaking change and then patching my packages to do the requisite if isdefined ....

DilumAluthge commented 4 weeks ago

Just a quick note: a few additional usages pop up if you change the Pkg.Types.stdlibs() (in your search) to Pkg.Types.stdlibs: https://juliahub.com/ui/Search?q=Pkg.Types.stdlibs&type=code

staticfloat commented 4 weeks ago

Just to double-check: the Pkg.Types.stdlibs() function is not currently public, right? So in theory we are allowed to make whatever breaking changes we want?

Yes, and perhaps the right thing to do here is to provide a stdlibs_names()::Vector{String} method for people, as it seems that's most of what people want to know. There do seem to be some people who want to check is_stdlib(::String), which we already have inside of Pkg, so it shouldn't be too hard to convert them to a new API if need be.

KristofferC commented 2 weeks ago

LGTM but I would prefer leaving the stdlibs etc functions as they were and make new functions for the new info. Just because I know people use Pkg internals a bit all over the place and it seems like there is not a huge gain to modify the existing functions over adding a new one.

DilumAluthge commented 2 weeks ago

Converting to draft so we don't accidentally merge before we remove the "drop me" commits.

staticfloat commented 2 weeks ago

Alright, I'm happy with this, the new HSG version has been published and as long as @KristofferC's happy with it, I think we're good to merge.