Pkg version list?

Is there a way to get a list of available versions of a package?

I’m trying to get ahead on updating my code for Julia 0.6 but a package my code depends on, DataFrames, doesn’t work in 0.6 when I simply use Pkg.add; it fails on percompilation. I’ve checked the DataFrames Github page but it wasn’t clear to me if there was a working version for 0.6.

Julia Version 0.6.0-dev.1843
Commit c38a5a3 (2017-01-01 14:09 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core™ i5-4570 CPU @ 3.20GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.9.1 (ORCJIT, haswell)

DataFrames 0.8.5

You can use Git for a hacked solution:

cd ~/.julia/v0.5/DataFrames
git tag --list v*

and you can run these commands from Julia too:

cd(Pkg.dir("DataFrames"))
versions = split(readstring(`git tag --list v*`), '\n')

Nice to know. Unfortunately there’s no context to the version, which one works in 0.6? 0.5? etc

In that case, I don’t see other solution other than inspecting the REQUIRE file for each version tag. If you add DataFrames in Julia v0.6 and it fails saying that there is no support for that version, then you have to wait for a new release of DataFrames.

How do you list versions not in the master branch?

Unhacked version:

Pkg.available(“DataFrames”)

2 Likes

Added to the list :slight_smile:

Pkg.available is not available :stuck_out_tongue: in 1.7.2, is there a new method for that?

A slight modification of Reading versions of a package from unpacked registry tarball - #2 by GunnarFarneback should give you a list of versions. But if you want it in the context of versions of some package you have as a dependency, PackageCompatUI is a more convenient tool.

Indeed, thank you!

function available_versions(pkgname::AbstractString)
    registry = only(filter(r -> r.name == "General", Pkg.Registry.reachable_registries()))
    pkg = only(filter(pkg -> pkg.name == pkgname, collect(values(registry.pkgs))))
    return keys(Pkg.Registry.registry_info(pkg).version_info)
end
2 Likes