How to verify the compatibility under different Julia versions for a package that is in development?

When developing a package, one has responsibility to check its compatibility under different Julia versions (6. Compatibility · Pkg.jl (julialang.org)). But how to implement this?

Specifically, MyPackage.jl was created and developed under Julia v1.9.0, now I want to check if it works well under the newly released Julia version v1.10.3. I have installed Julia v1.10.3 (portable) without uninstall the older Julia v1.9.0. How can I test whether MyPackage.jl works well or not under the new version?

Launch the Julia version you want, and run the package tests:

julia> ] activate --temp

(jl_bz8NbD) pkg> dev MyPackage

(jl_bz8NbD) pkg> test MyPackage

That’s made particularly easy if you install Julia with juliaup, in which case launching different versions of Julia involves just choosing the version with julia +1.9.2, for example.

In parallel, the standard is to run CI workflows on github on some Julia versions you intend to support (usually the lowest supported version and perhaps the latest stable or nighly version of Julia as well).

5 Likes

Thank you professor for your response! I would also like to inquire, is it possible to develop a package using different versions of Julia? What I mean is, if I upgrade Julia during the development process (and remove the old version of Julia), can I continue developing the package with the new version of Julia? If it is necessary to develop a Julia package using the same version, then it would inevitably require installing multiple versions of Julia. I believe Julia is designed to allow the coexistence of multiple different versions, as it creates separate directories for different versions under the ~/.julia/environments/ directory. Since very early days, you and many other experienced seniors here have strongly recommended that I use juliaup to switch between different versions, but I have been hesitant to try it (maybe I’ll use it after a while) because I adhere to the “Occam’s razor principle”, in other words, unless necessary, I am curious about how to switch between multiple versions of Julia without relying on juliaup, even if it may be more cumbersome (Because I think it helps me understand how Julia works).

To sum up, my questions are mainly:

  1. Is it possible to develop a package using different versions of Julia? If I upgrade Julia during the development process (and remove the old version of Julia), can I continue developing the package with the new version of Julia?
  2. How to manage multiple versions of Julia in the most primitive way (with VS Code) without using juliaup?

Thanks!

  1. yes, everybody does that all the time.

  2. why? why? why? Just use juliaup! It now the officially recommended way to do it.

4 Likes

OK! thank you. I’ll follow your instruction!

But I still wonder if there is some way without the use of juliaup. I see in VS Code I can select a julia environment (click the Julia env button on the status bar), and there are multiple versions can be selected. If I select the new version v1.10, the status bar will dispaly Julia env: v1.10, but it doesn’t seem to really change. Can I switch versions in this way and how?

That I don’t know. I don’t switch Julia versions that often. When need to, I set, outside VSCode:

juliaup default 1.9.2 

or the version I want, and then launch VSCode, which will use the default version I chose.

2 Likes

I open with Julia v1.10.3 a package that is developed with Julia v1.9.0, it reports:

julia> ┌ Warning: The active manifest file has dependencies that were resolved with a different julia version (1.9.0). Unexpected behavior may occur.

Does this mean that it is unsafe to develop a package with different Julia versions? And how to upgrade the package developed with v1.9.0 to the current v1.10.3?

No, but update things with: julia> ] up before, to get the packages updated as well. In Julia 1.11 I think you’ll be able to have different Manifest files for each Julia version.

1 Like