Programatically access version of third party package

I would like to access the version information of an installed third-party package in terms of a VersionNumber object or similar. Is this possible somehow? I did bit of digging in the documentation of Base and Pkg, but nothing useful popped up.

To clearify: Essentially I am searching for the python package.__version__ equivalent in julia, i.e. some mechanism (or standard) where one can expect the version info of a package to be available or exported.

You may be interested in Pkg.dependencies.


Thanks @dilumaluthge Since I just started exploring 1.4 Pkg.dependencies() and Pkg.project() were new to me. Definitely an interesting pointer. Unfortunately on the current project, I’d need a julia 1.3 solution as well …

So from all digging I did inside Pkg. It seems Pkg.dependencies() is really the simplest way to do this. As far as I can judge, most of the underlying scaffolding it uses has been added just in 1.4 … so maybe I’m just out of luck for 1.3. Still happy if anyone comes up with a clever idea :smile:.

Since 1.4 was just released, presumably it can be installed in any environment that had a working 1.3 installation?

Thanks for the suggestion. In this case it’s a bit convoluted, because I want to use julia to provide some functionality for a python-based package and in order to make the transition for people smooth, I’d want to be as broad as possible wrt. julia version as possible.

On the other hand most people will need install julia in this context either way, so one might as well insist they go for 1.4.

On that note: In Julia 1.3 there is Pkg.installed(), which returns a list of direct dependencies and their versions. This command is, however, deprecated in 1.4.

What is the problem that you are trying to solve?

1 Like

Simply put: I want to return the version of a particular installed Julia package to python using pyjulia.

It would be easier to help if you described what you are trying to achieve, instead of how you imagine doing it. cf

In particular, managing packages and versions in Julia is declarative: you specify what you need, and it will be taken care of. Trying to do anything else is going against the grain.