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?
e3c6
August 26, 2023, 11:09am
2
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```
e3c6
August 26, 2023, 12:29pm
4
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:
opened 07:44PM - 28 Aug 23 UTC
closed 08:59PM - 28 Aug 23 UTC
I created a simple package and in the compat section of Project.toml I restricte… d the compatibility with `julia = "1.0 - 1.7"`. I then tried to add this package to a newly activated temp environment from Julia 1.9.3, but this did not produce an error or warning. The following is a snapshot of the REPL:
```julia-repl
(@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>
```
My understanding is that an error should have resulted. I made a post about this on discourse at https://discourse.julialang.org/t/package-compatibility-constraints/103217 and none of the responses convinced me that this is the intended behaviour of Julia.
The entire source code of the package is available at https://github.com/GHTaarn/VerExperiment.jl
I am using Ubuntu 22.04 on x86_64 with Julia installed with juliaup.
<!--
If you have a question please search or post to our Discourse site: https://discourse.julialang.org.
We use the GitHub issue tracker for bug reports and feature requests only.
If you're submitting a bug report, be sure to include as much relevant information as
possible, including:
1. The output of `versioninfo()`
2. How you installed Julia
3. A minimal working example (MWE), also known as a minimum reproducible example
If you're experiencing a problem with a particular package, open an issue on that
package's repository instead.
Thanks for contributing to the Julia project!
-->
1 Like
And it is fixed already
but only for Julia 1.11…
JuliaLang:master
← Krastanov:patch-1
opened 04:34PM - 25 Jun 23 UTC
Pkg now raises an error if the `[compat]` entry for `julia` is not met for a pac… kage.
This change was made due to new developers getting confused why their julia 1.8 does not work with a dev-ed package that has a julia compat set to 1.9.
There is no escape hatch, i.e. this behavior can not be disabled.
4 Likes