Do you mean that the mere presence of a [workspace] section will cause an error on older Julia versions, or just that we won’t get the new functionality on older versions?
Generally, older Julia version will just ignore sections they don’t understand.
Since this topic seems to cause a lot of confusion here’s a full example on how I use it and how it plays with julia versions from 1.10 to 1.12:
./Project.toml
name = "NetworkDynamics"
uuid = "22e9dc34-2a0d-11e9-0de0-8588d035468b"
version = "0.10.14"
authors = [...]
[workspace]
projects = ["test", "benchmark", "docs"]
[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Atomix = "a9b6321e-bd34-4604-b9c9-b65b8de01458"
[compat]
ArgCheck = "2.3.0"
Atomix = "1"
./test/Project.toml
name = "NetworkDynamics-Tests"
[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
[sources]
NetworkDynamics = {path = ".."}
[compat]
Adapt = "≥0.0.1"
Aqua = "0.8.9"
I consider 2 use cases for my sub environments:
A) automated testing (what happens in ] test), mainly for CI
B) manual activation for dev, i.e. to start julia --project=@. in the test folder and start sending parts of your test files to the repl interactively, thats how I do 90% of my Julia work. (similar to what TestEnv.jl achives)
A) just works. Since ever (pre 1.2 maybe?) Julia supports nested test environments. Pkg will see that you have a Project.toml in the test subfolder and use that to create a combined Manifest.
B) is a bit more nuanced:
- Julia 1.10: That one is a bit annoying. It neither supports
Mainfest-v1.10 nor the sources block. So you need to manually ] dev .. from test to add your main package to that env. Then it kinda works. However switching between main env, doc env and test env can be annoying since you need to update all envs independently which will lead to a lot of recompilation. (EDIT: apparently Mainfest-v.1.10 is a thing now!)
- Julia 1.11: Just activate the environment. Ideally, rename your Manifest to
Manifest-v1.11. It will respect the sources section, so it is easier to set up than 1.10, but still has a different manifest in each subfolder (thus cause more compilation because of slighly different versions)
- Julia 1.12: If you start
julia --project=@. in the test dir, it will activate the test env as part of the workspace (indicated as NetworkDynamics/test) and resolve everything in the main Mainfest in root. Problem: I think this detection is blocked if there is a Manifest in test, hence the Manifest-v1.11 for 1.11. (i am not 100% sure on that).
So if you often change between v1.10 and v1.12 in your development it is annoying. Switching between 1.10 and 1.11 is fine, because you’ll have Manifest.toml and Manifest-v1.11.toml in your test folder (and other worspaces). I mainly switch between 1.11 and 1.12, so I use the v1.11 Manifests in root and all my workspaces, while v1.12 resolves everything in one Manifest-v1.12 in root.
Usecase B) is equivalent for docs and benchmark environments. Those sub-envs look ballistically identical to the test one shown above.
Bonus pet peeve: CompatHelper requires you to have compats for all packages. Lets say my main package depends on adapt so does my test env. I don’t want duplicate entries, because they will never be resolved independent of each other. Thats why I put the open Adapt = "≥0.0.1" compat there, just to please CompatHelper.