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

**URL:** https://discourse.julialang.org/t/adding-sources-information-for-a-dependency-which-is-in-a-subdirectory/121104
**Category:** General Usage
**Created:** [October 9, 2024, 11:28am UTC](https://discourse.julialang.org/t/adding-sources-information-for-a-dependency-which-is-in-a-subdirectory/121104 "2024-10-09T11:28:22Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![SamBrand](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@SamBrand](https://discourse.julialang.org/u/SamBrand)
#### Post date: [October 9, 2024, 11:28am UTC](https://discourse.julialang.org/t/adding-sources-information-for-a-dependency-which-is-in-a-subdirectory/121104/1 "2024-10-09T11:28:22Z")

</div>

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.

```julia
[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`?

---

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [October 9, 2024, 11:33am UTC](https://discourse.julialang.org/t/adding-sources-information-for-a-dependency-which-is-in-a-subdirectory/121104/2 "2024-10-09T11:33:50Z")

</div>

> **[10. Project.toml and Manifest.toml · Pkg.jl](https://pkgdocs.julialang.org/dev/toml-files/#The-%5Bsources%5D-section)**
>
> Documentation for Pkg.jl.

you want something like:

```julia
[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

---

<div class="post-metadata">

### Author: ![SamBrand](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@SamBrand](https://discourse.julialang.org/u/SamBrand)
#### Post date: [October 9, 2024, 11:35am UTC](https://discourse.julialang.org/t/adding-sources-information-for-a-dependency-which-is-in-a-subdirectory/121104/3 "2024-10-09T11:35:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [October 9, 2024, 11:36am UTC](https://discourse.julialang.org/t/adding-sources-information-for-a-dependency-which-is-in-a-subdirectory/121104/4 "2024-10-09T11:36:22Z")

</div>

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](https://github.com/JuliaLang/Pkg.jl/issues/4026).

---

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [October 9, 2024, 11:36am UTC](https://discourse.julialang.org/t/adding-sources-information-for-a-dependency-which-is-in-a-subdirectory/121104/5 "2024-10-09T11:36:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![SamBrand](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@SamBrand](https://discourse.julialang.org/u/SamBrand)
#### Post date: [December 4, 2024, 11:39am UTC](https://discourse.julialang.org/t/adding-sources-information-for-a-dependency-which-is-in-a-subdirectory/121104/6 "2024-12-04T11:39:32Z")

</div>

It looks like having `subdir` (like already exists for `Pkg.add`) for `[sources]` is coming soon!

> <https://github.com/JuliaLang/Pkg.jl/pull/4039/commits/6ce36d95dcb35da07db30f7cf1f5b6d1da3a09ed>
>
> Monorepos exist, so we shouldn't complain when somebody tries to combine
> the url… and subdir parameters.

I think its missed the cut for julia v1.11.2 but I assume will be in v1.11.3
