Adding [sources] information for a dependency which is in a subdirectory

Hi everyone,

In a current project I’m using Pkg.add(url="url/to/pkg", subdir = "in/this/subdir") . Now with 1.11 there is a [sources] section of the Project.toml file that makes this approach just a little bit nicer (e.g. I can delete the Manifest.toml without having to using Pkg.add again).

However, it appears that the subdir kwarg is not replicated in the source specification.
e.g.

[sources]
UnregPkg = {url="url/to/pkg", subdir = "in/this/subdir"}

doesn’t work and fails with

ERROR: Invalid key subdir in source section

Is there a work around? Am I missing something? Or should I add an issue to Pkg.jl?

1 Like

you want something like:

[sources]
Example = {url = "https://github.com/JuliaLang/Example.jl", rev = "custom_branch"}
SomeDependency = {path = "deps/SomeDependency.jl"}

as a side note, I continue to want managing Project.toml to be easier from REPL

2 Likes

Kind of but neither of those hit my usecase precisely. If they did, then the subdir kwarg to Pkg.add wouldn’t be needed.

The subdir case was forgotten when [sources] was implemented. See sources section of Project.toml does not support subdir · Issue #4026 · JuliaLang/Pkg.jl · GitHub.

2 Likes

oh I see what you’re saying, you want a url but with subdir, not a relative path, sorry my bad.

2 Likes