# How to handle compat when a dep is only used in an extension?

**URL:** <https://discourse.julialang.org/t/how-to-handle-compat-when-a-dep-is-only-used-in-an-extension/127284>\
**Category:** General Usage\
**Created:** [March 23, 2025, 4:43pm UTC](https://discourse.julialang.org/t/how-to-handle-compat-when-a-dep-is-only-used-in-an-extension/127284 "2025-03-23T16:43:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![yolhan\_mannes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yolhan_mannes/32/220485_2.png) [@yolhan\_mannes](https://discourse.julialang.org/u/yolhan_mannes)\
**Post date:** [March 23, 2025, 4:43pm UTC](https://discourse.julialang.org/t/how-to-handle-compat-when-a-dep-is-only-used-in-an-extension/127284/1 "2025-03-23T16:43:24Z")

</div>

I’m using Julia’s extensions system (with `ext/` and `[extensions]` in `Project.toml`), and I ran into a small issue. I use a package like `QuadGK` _only_ inside an extension (e.g. for `DataInterpolationsExt`), but Aqua marks it as a stale dep if I put it in `[deps]`, since it’s not used in the main code.

If I leave it out of `[deps]`, I can’t set a `[compat]` entry for it — which feels risky, since I still rely on it. I’m wondering how others handle this? I’d love to hear if there’s a clean way to keep Aqua happy _and_ track versions of deps used only in extensions.

Sorry for the chatgpt message, didn’t know how to explain it clearly.  
Thanks

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [March 23, 2025, 7:16pm UTC](https://discourse.julialang.org/t/how-to-handle-compat-when-a-dep-is-only-used-in-an-extension/127284/2 "2025-03-23T19:16:33Z")

</div>

If you use it inside an extension it should be in weakdeps?

---

<div class="post-metadata">

**Author:** ![yolhan\_mannes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yolhan_mannes/32/220485_2.png) [@yolhan\_mannes](https://discourse.julialang.org/u/yolhan_mannes)\
**Post date:** [March 23, 2025, 7:23pm UTC](https://discourse.julialang.org/t/how-to-handle-compat-when-a-dep-is-only-used-in-an-extension/127284/3 "2025-03-23T19:23:33Z")

</div>

does not seem to find it

```julia
[weakdeps]
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"

[extensions]
BloodFlowTrixiDataInterpolationsExt = "DataInterpolations"

```

and I don’t wanna do this

```julia
[weakdeps]
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"

[extensions]
BloodFlowTrixiDataInterpolationsExt = ["DataInterpolations","QuadGK"]

```

because it would force people to add both to access the ext. For now, I think I should have it as strong dep and just add a using statement to make Aqua happy

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [March 24, 2025, 2:00pm UTC](https://discourse.julialang.org/t/how-to-handle-compat-when-a-dep-is-only-used-in-an-extension/127284/4 "2025-03-24T14:00:13Z")

</div>

> [@yolhan\_mannes](#):
>
> because it would force people to add both to access the ext.

Indeed, that’s what I was suggesting. Otherwise it’s a useless main dep for your package and Aqua is right. You can probably ignore it manually within Aqua though.

---

<div class="post-metadata">

**Author:** ![yolhan\_mannes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yolhan_mannes/32/220485_2.png) [@yolhan\_mannes](https://discourse.julialang.org/u/yolhan_mannes)\
**Post date:** [March 24, 2025, 2:07pm UTC](https://discourse.julialang.org/t/how-to-handle-compat-when-a-dep-is-only-used-in-an-extension/127284/5 "2025-03-24T14:07:26Z")

</div>

Yes for now I just added it to the using statement at the beginning it made aqua happy and since it’s light I’m fine with it.  
It would be nice if each extension could have its own project.toml even though it could lead to crazy dependencies

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [March 24, 2025, 3:09pm UTC](https://discourse.julialang.org/t/how-to-handle-compat-when-a-dep-is-only-used-in-an-extension/127284/6 "2025-03-24T15:09:38Z")

</div>

The problem is that, by definition, an extension is only loaded when its triggers are present in the environment. If that dependency is only useful in the extension, then it should be an extension trigger, and users should be asked to load it explicitly. As things stand, you’re just burdening the main package for nothing?

---

<div class="post-metadata">

**Author:** ![yolhan\_mannes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yolhan_mannes/32/220485_2.png) [@yolhan\_mannes](https://discourse.julialang.org/u/yolhan_mannes)\
**Post date:** [March 24, 2025, 3:38pm UTC](https://discourse.julialang.org/t/how-to-handle-compat-when-a-dep-is-only-used-in-an-extension/127284/7 "2025-03-24T15:38:29Z")

</div>

Yes but its really understandable for the user that they need to add DataInterpolations to do what the extension does but not QuadGK, I’ve open a feature request to DataInterpolations to get the length of curve from it without relying on this so, if it is important enough for people, all this won’t be a problem anymore (in my case)

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [March 24, 2025, 8:37pm UTC](https://discourse.julialang.org/t/how-to-handle-compat-when-a-dep-is-only-used-in-an-extension/127284/8 "2025-03-24T20:37:30Z")

</div>

> [@yolhan\_mannes](#):
>
> It would be nice if each extension could have its own project.toml even though it could lead to crazy dependencies

The danger of extensions loading their own dependencies is a runaway chain reaction. `ABExt` has `using C`, so that triggers `BCExt`, which has `using D` and that triggers `CDExt`, etc. While loading a package also loads a tree of implicit dependencies, there is an acceptance that each package needs what it needs. On the other hand, `ABExt` obviously does not need `BCExt`, `D`, or `CDExt` to work, and loading unnecessary modules goes against the intention of extensions. Extensions have restrictions for good reasons.
