Updating with nested Project.toml

In the package I am developing, I follow the best practice of having a separate Project.toml, test/Project.toml, and docs/Project.toml.

Unfortunately, this means my dependency versions get out of sync if I run ]update in the base project but not the others.

Is there a “topgrade” for Julia that automatically searches a directory subtree for Project.tomls and runs ]update?

1 Like

Hello,
In Julia, you can create a custom script to update all Project.toml files in your directory tree. Use the Glob package to find all Project.toml files recursively and run Pkg.update() on each one. Here’s a brief script: patient gateway login

using Pkg, Glob

function update_project(project_path)
    println("Updating project at $project_path")
    Pkg.activate(project_path)
    Pkg.update()
end

for project_file in glob("**/Project.toml", ".")
    update_project(dirname(project_file))
end

Save this as update_all_projects.jl and run it with julia update_all_projects.jl to keep all dependencies in sync.

2 Likes