Link Project.toml files (or make /test/Prokect.toml depend on main package one)

I have a julia project that has a Project.toml file setting its dependencies. It also have a set of tests, for which I have a Project.toml file setting some additional dependencies that are needed for the tests only (like SafeTestsets.jl).

When I update my main Project.toml dependencies, I typically want the same update in the test one. Is there a way to “link” these, so that the /test/Project.toml automatically uses the package dependencies from the main Project.toml?

This would save me having to update both whenever package dependencies are updated. More importantly, it will prevent troubles when I inevitably forget to update the /test/ one.

See https://github.com/JuliaLang/Pkg.jl/issues/1233.

I would say we have a pretty good idea of how to implement this so I am quite confident it will come in 1.10.

3 Likes

Exciting, looking forward to it :slight_smile:

This is one of the main reasons I still recommend using the single Project.toml with the [extras] section.

1 Like

So that’s what I had. But then I sometimes wanted to run a script using my test environment, but I could only Pkg.activate the main toml, which didn’t give me the [extras] part. I figured by changing to 2 Project.toml’s I could activate either environment as I wanted.

(but this is maybe possible in some way anyway?)

TestEnv.jl is helpful for this.

2 Likes

That looks perfect, thanks :slight_smile:

1 Like