In Julia 1.4.0-rc2, Pkg.installed() is now deprecated:
julia> using Pkg
julia> Pkg.installed()
┌ Warning: Pkg.installed() is deprecated
â”” @ Pkg D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Pkg.jl:531
Dict{String,VersionNumber} with 3 entries:
"StatsBase" => v"0.32.2"
"BoltzmannMachines" => v"1.2.0"
"Tables" => v"1.0.3"
It would be helpful if the deprecation message gave some hint about the replacement. Could you tell me what the alternatives are for using Pkg.installed?
Thank you very much!
In this issue there is already a discussion about Pkg.installed: https://github.com/JuliaLang/Pkg.jl/issues/697
I find the solution to use Pkg.add not sufficient because it seems a bit heavyweight, in particular I would like to avoid output to the command line.
The replacement for Pkg.installed is Pkg.dependencies.
https://julialang.github.io/Pkg.jl/dev/api/#Pkg.dependencies
Thanks @DilumAluthge
When I click at the link it says that this is an "experimental feature". Will this be experimental after the release of Julia 1.4? If yes, then I would say that the deprecation of Pkg.installed is too early. Deprecation says: "Please migrate your code" and this then forces migrating to code that is experimental.
Besides that, the replacement seems worse to me: Pkg.installed allows an access via the name of the package. With Pkg.dependencies, I need the UUID, which I have to search first. If I use it in code then, I have to document this seperately, whereas I can get the meaning of the code "Tables" in keys(Pkg.installed()) at one glimpse. (But this could, of course, also be more straigthforward.)
If you just want to see the packages installed, you don't necessarily need Pkg. Instead, you can type ] in your console to get into pkg environment and simply type st to show all the packages installed by yourself.
@MTone92 The problem with Pkg.status is that it prints something. Pkg.installed returns a Dict, which can easily be inspected in code (not only manually). So Pkg.status is not a suitable replacement for Pkg.installed.
If possible, can add a subcommand list or ls? I think many package managers use this for listing installed packages rather than status or st. As a new user, I feel quite confused when I can't find the list subcommand in such a package manager.
Most helpful comment
Thanks @DilumAluthge
When I click at the link it says that this is an "experimental feature". Will this be experimental after the release of Julia 1.4? If yes, then I would say that the deprecation of
Pkg.installedis too early. Deprecation says: "Please migrate your code" and this then forces migrating to code that is experimental.Besides that, the replacement seems worse to me:
Pkg.installedallows an access via the name of the package. WithPkg.dependencies, I need the UUID, which I have to search first. If I use it in code then, I have to document this seperately, whereas I can get the meaning of the code"Tables" in keys(Pkg.installed())at one glimpse. (But this could, of course, also be more straigthforward.)