Package compatibility constraints

I put the following line into a Project.toml for a package and am trying to figure out what consequences it has:

[compat]
julia = "1.0 - 1.7"

When I try to add this package in another package from Julia 1.9.3 it is accepted without a warning and I can use it without warnings or incorrect behaviour. What consequences should I expect with compatibility specifications in a package?

What do you mean by this? The version of Julia you are running is v1.9.3?

How are you installing your package? Pkg.add or Pkg.develop?

Yes, Julia version is 1.9.3, installing with add:

~/Program/UseVerExperiment.jl$ julia --project
Installing Julia 1.9.3+0.x64.linux.gnu
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.3 (2023-08-24)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(UseVerExperiment) pkg> st
  Installing known registries into `~/.julia`
Project UseVerExperiment v0.1.0
Status `~/Program/UseVerExperiment.jl/Project.toml` (empty project)

(UseVerExperiment) pkg> add ../VerExperiment.jl/
     Cloning git-repo `/home/julia/Program/VerExperiment.jl`
    Updating git-repo `/home/julia/Program/VerExperiment.jl`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
    Updating `~/Program/UseVerExperiment.jl/Project.toml`
  [2296e2b5] + VerExperiment v0.1.1 `../VerExperiment.jl#master`
    Updating `~/Program/UseVerExperiment.jl/Manifest.toml`
  [2296e2b5] + VerExperiment v0.1.1 `../VerExperiment.jl#master`
Precompiling project...
  2 dependencies successfully precompiled in 1 seconds

julia> using VerExperiment

julia> VerExperiment.greet()
Hello World!
j```

I’m not sure if when you add by path like that, it enforces the Julia version. I’m also interested in the answer, let’s see if some of the Pkg people offer some wisdom.

1 Like

Did you try:

[compat]
julia = "~1.0 - ~1.7"

Thanks for the suggestion, I tried it, but Julia did not accept that format. I also tried the more terse

[compat]
julia = "~1.0, ~1.1, ~1.2, ~1.3, ~1.4, ~1.5, ~1.6, ~1.7"

but it still does not lead to the package being rejected

To make this easy to reproduce I have published the example on Github GitHub - GHTaarn/VerExperiment.jl: Experiment about Julia version restrictions so one can just make a temp environment and add it:

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

(jl_ftvi0S) pkg> add https://github.com/GHTaarn/VerExperiment.jl
  Installing known registries into `~/.julia`
     Cloning git-repo `https://github.com/GHTaarn/VerExperiment.jl`
    Updating git-repo `https://github.com/GHTaarn/VerExperiment.jl`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
    Updating `/tmp/jl_ftvi0S/Project.toml`
  [2296e2b5] + VerExperiment v0.1.1 `https://github.com/GHTaarn/VerExperiment.jl#master`
    Updating `/tmp/jl_ftvi0S/Manifest.toml`
  [2296e2b5] + VerExperiment v0.1.1 `https://github.com/GHTaarn/VerExperiment.jl#master`
Precompiling project...
  1 dependency successfully precompiled in 0 seconds

julia> using VerExperiment

julia> VerExperiment.greet()
Hello World!
julia> 
1 Like

I opened an issue about this on Github:

1 Like

And it is fixed already :grinning:
but only for Julia 1.11… :face_exhaling:

4 Likes