Compat entry for non-dependency

In the Project.toml of package A, I would like to restrict compatibility for package B that is not a dependency.

(why I am doing this)

The motivation is following up on an array index ordering change of MCMCDiagnosticTools.jl which is not a direct dependency of DynamicHMC.jl, but the latter has a utility function for stacking posteriors in this order and I don’t want users to accidentally end up with incompatible arrays.

The following works:

[extras]
B = "uuid of B"

[compat]
B = "the.version"

but I am not sure if it is the indended API, I find [extras] to be somewhat underdocumented.

2 Likes

As far as I know that’s what you can do for now. Julia 1.9 will bring more possibilities and some more documentation. See add support for package extensions by KristofferC · Pull Request #3264 · JuliaLang/Pkg.jl · GitHub.

1 Like

As far as my testing goes prior to julia 1.9 this only works for the environment of A, if you add A and B to environment C you might still get incompatible versions.

1 Like