Best practice to set limits for Julia version

What is the best practice to set the limits for the Julia version of a package?

To my experience packages like QML.jl that rely on C++ code break with new Julia versions.
I could add for example:

[compat]
julia = "1.6, 1.7, 1.8"

to the compat section, but would that have any effect?

I want that the installation of this package using Julia 1.9 or higher fails.

1 Like

I tested this in a similar situation yesterday and it had no effect

Is this a bug? If it is a bug, is it a bug in Julia or in Pkg.jl?

Well, the behaviour that I get is not what I expected. My plan is to wait until Monday, allowing people with more knowledge about this to come back from the weekend. I have not been able to find documentation specifying what the behaviour should be.

That doesn’t do what you probably think it does: each of “1.6”, “1.7”, “1.8” means “from this version to any other following version in the 1.x series”, and then “1.6, 1.7, 1.8” is the union of the sets defined in that way, which is just the same as “1.6” alone. You may want to read 6. Compatibility · Pkg.jl

3 Likes

Here is an example of an upper-bounded package version:

(@v1.9) pkg> activate --temp
  Activating new project at `/tmp/jl_SEj278`

(jl_SEj278) pkg> add LocalRegistry@0.5.2
    Updating registry at `~/.julia/registries/CVRegistry.toml`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package LocalRegistry [89398ba2]:
 LocalRegistry [89398ba2] log:
 ├─possible versions are: 0.1.0-0.5.5 or uninstalled
 ├─restricted to versions 0.5.2 by an explicit requirement, leaving only versions: 0.5.2
 └─restricted by julia compatibility requirements to versions: 0.5.3-0.5.5 or uninstalled — no versions left
1 Like

Well, I was reading this section so far perhaps a dozen of times, but it is not intuitive at all. I think we need a web based calculator to check the meaning of compat bounds.

Would this be correct from your point of view:

[compat]
julia = "~1.6, ~1.7, ~1.8"

?

1 Like

I believe you could also use hyphen:

[compat]
julia = "1.6 - 1.8" # 1.6.0 -> 1.8.*

Very inconsistent that you do not need the tilde in this notation…

Example 1 shows seeing the Julia version:

Why, if it’s about QML.jl failing (or some other package “that rely on C++ code” breaking), shouldn’t that package have those limits?

And also if QML broke for some reason (because of Julia) in the past, is it likely to happen again?

CxxWrap has julia = "1.6" in [compat] since it’s supposed to work into the foreseeable future. And QML also has the same (plus CxxWrap) in its. So it’s promising it should work. Are you sure either of those being the reason of your code breaking with a Julia update?

Of course I am not sure, but I think it is better if a user gets a warning if he is using a Julia version
that was not tested with a package. If he gets a warning at all, still need to check if that really happens.

It is naive to assume that old packages work with new Julia versions, at least until the exported api is more formally specified and tested.

The user will not get a warning, rather be blocked from using (even if actually ok)?

In an ideal world you shouldn’t test with newer (no yet existing Julia) versions, because they are supposed to be compatible.

I’m just asking if you know, since I found it very surprising for QML or CxxWrap. Also if those are the problem, then those should do the limiting (ideally), and you should trust them to do that. They could retroactively change helping all. You doing it only helps your package, and doesn’t even if not retroactively.

It is naive to assume that old packages work with new Julia versions, at least until the exported api is more formally specified and tested.

There are some known (very few) exceptions to that. Not those packages I though (however Cxx.jl was one). I would like to fix the issue for such packages for benefit of all.

Well, as explained in another thread Julia/ Pkg is currently ignoring upper bounds for Julia in packages anyways, so adding them to a package has more the character of documentation. This will only change for Julia 1.11.

Pkg has always respected the Julia compat bound when installing packages from a registry. What’s changing is the behavior of adding packages from local paths or explicit URLs.

2 Likes

Thanks for clarifying!