I’m new to Julia, but have been a software engineer for a while working in various languages. I’ve been studying how Julia Pkg behaves in regards to dependency versions, manifests, and test target. I think there’s a need for Pkg develop
with manifest inheritance.
This is a similar topic to Is there concept of dev dependencies in Pkg? - #10 by andre1sk
Sandbox dev problem
Our team uses this sandbox development workflow to add useful development packages, and generally works in this environment.
$ mkdir sandbox
$ cd sandbox
$ julia --project=.
julia> ]
(sandbox) pkg> dev ../
(sandbox) pkg> add Revise Infiltrator BenchmarkTools
We commit the root project’s Manifest.toml so that all developers are working with the exact same versions. The problem is the sandbox
has a separate manifest, so pkg versions can differ (within the limitations of compat) depending on when the developer last did an update
in their sandbox. This negates the benefits of committing the Manifest file as now our developers may be working with different package versions.
Test-specific dependencies behavior
The version behavior I want already exists in Julia, but only for ] test
This is underdocumented (maybe I should add these notes to the docs?), but test
will always use the package versions of the root Manifest, even when a package is added to the test project.
For example, if you have:
- root Project
[compat] Example = "0.5"
Example v0.5.4
in root manifestExample v0.5.5
in test manifest
When you run ] test
, you will see this warning and Example
will be v0.5.4 in both runtests.jl and the root project’s module.
Warning: Entry in manifest at “C:\Users\awhite\code\playground\TestTest\test” for package “Example” differs from that in “C:\Users\awhite\code\playground\TestTest\Manifest.toml”
Note: a similar problem to sandbox here is if you activate the test environment separately, this special test context and manifest version behavior is lost.
julia --project=test
julia> using Example; pkgversion(Example)
v"0.5.5"
Proposed Solution
So what I would like is a way to create project environments that have the test
inherit other manifest versions behavior.
] dev --inherit-manifest ..
Though one problem is what if you do this with multiple packages? So maybe it should be a feature of Project.toml inherit_manifest = ".."
Also, it seems like it would be better if test/Project.toml used this feature, so the environment you have when activating (julia --project=test
) is the same as ] test
. And since test doesn’t use dev ..
this is an argument for Project.toml feature.