Explicit version ranges in compat section in Project.toml?

Is it possible to specify an explicit version range in the [compat] section of a “Project.toml” file? To prevent resolution failure among several packages with inter-dependencies, while also satisfying the new rules for automatic package registration, I need to specify something like

[compat]
ElasticArrays ">= 0.2, < 2.0"

Of course, the above is not legal syntax - but is this possible in some way?

See:

1 Like

Thanks for the link! I so hope that get’s backported to v1.0 - with the current drive to tigher deps bounds, we may end up in dependency version hell without the ability to specify ranges.

2 Likes

Can you elaborate? The range syntax is just convenience for things that already work, so not sure why it would be critical or help version resolution.

Can you elaborate? The range syntax is just convenience for things that already work

Oh, maybe I got this wrong - is there already a way to specify: “This dependency I need in [v0.2, v2,0)” in a “Project.toml”? That’s basically what I meant with my original question - but I understood @tkf’s reply (thanks!) as “not possible yet”.

Yea, you simply list the versions you are compatible, e.g.

PackageA = "0.2, 0.3, 1, 2"
3 Likes

Argh - it’s right there in the docs, and I didn’t see it facepalm. Sorry about the noise!

How do you express PackageA = "0.2 -- 0"?

Why do you wanna express that? Then you might as well just leave the bounds empty.

1 Like

Doesn’t it mean [0.2, 1)? https://github.com/JuliaLang/Pkg.jl/pull/1410#discussion_r328480875 If not, I’d use PackageA = "0.2 - 0.9999". It certainly is doable with current [compat] but I prefer not to repeat so many version numbers.

I guess my question is:

Is it compatible with PackageA v0.4 and v0.99?

1 Like

My point is that there is a finite set of (breaking) releases that you are compatible with, and you can always list those explicitly.

1 Like

I think one of the common usecases might be for declaring that “this package is loose at compatibility until all the dependencies are stable enough (>= 1.0)” (*). This is exactly what "0.x - 0" means and it is practically impossible to do with current [compat] syntax IIUC.

(*) Doing this while being compatible with Julia’s version of SemVer is technically possible.

I agree, I’ve had that use-case. :slight_smile:

Also, sometimes you only need a fairly small subset of features from a package, introduced fairly early on and quite stable afterwards (while other parts of the package are still evolving). So you may actually be compatible with that package at, say [0.2, 2.0). Intervals in Project.toml would be useful here, since otherwise you may end up with “0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 0.11, …, 1.0”.

I think this situation is not uncommon, actually.