# Upper bound for minor version of a dependency

**URL:** https://discourse.julialang.org/t/upper-bound-for-minor-version-of-a-dependency/98816
**Category:** General Usage
**Tags:** question
**Created:** [May 13, 2023, 10:18pm UTC](https://discourse.julialang.org/t/upper-bound-for-minor-version-of-a-dependency/98816 "2023-05-13T22:18:31Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ferrolho](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ferrolho/32/213665_2.png) [@ferrolho](https://discourse.julialang.org/u/ferrolho)
#### Post date: [May 13, 2023, 10:18pm UTC](https://discourse.julialang.org/t/upper-bound-for-minor-version-of-a-dependency/98816/1 "2023-05-13T22:18:31Z")

</div>

Is there a way of setting an upper bound for the minor version of a dependency in the `[compat]` section of Project.toml?

I want to set the compatible versions of a dependency to the range `[1, 1.5]` or `[1, 1.6)`. This is because that dependency has actually broken things on a minor version update, from `1.5.9` to `1.6.0`, so I want to declare that my package X depends on package Y but up to `1.5.9` at most.

I have tried to set it as `X = "1, 1.5"` and `X = "1, <1.6"`, but Julia is choosing to install `1.6.0`. I have also tried `X = "<1.6"`, which actually works; but that seems to not follow the guidelines of the General registry, because I get:

> The following guidelines were not met:
> 
> The following dependencies do not have a `[compat]` entry that is upper-bounded and only includes a finite number of breaking releases: X

I’m using Julia 1.8.5 / 1.9.

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [May 13, 2023, 10:43pm UTC](https://discourse.julialang.org/t/upper-bound-for-minor-version-of-a-dependency/98816/2 "2023-05-13T22:43:11Z")

</div>

I think you want a tilde:

```julia
[compat]
PkgA = "~1.2.3" # [1.2.3, 1.3.0)
PkgB = "~1.2" # [1.2.0, 1.3.0)
PkgC = "~1" # [1.0.0, 2.0.0)
PkgD = "~0.2.3" # [0.2.3, 0.3.0)
PkgE = "~0.0.3" # [0.0.3, 0.0.4)
PkgF = "~0.0" # [0.0.0, 0.1.0)
PkgG = "~0" # [0.0.0, 1.0.0)

```

[https://pkgdocs.julialang.org/v1/compatibility/#Tilde-specifiers](https://pkgdocs.julialang.org/v1/compatibility/#Tilde-specifiers)

---

<div class="post-metadata">

### Author: ![ferrolho](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ferrolho/32/213665_2.png) [@ferrolho](https://discourse.julialang.org/u/ferrolho)
#### Post date: [May 13, 2023, 10:48pm UTC](https://discourse.julialang.org/t/upper-bound-for-minor-version-of-a-dependency/98816/3 "2023-05-13T22:48:51Z")

</div>

Thank you for your prompt reply!

If I use the tilde, as in `X = "~1.5"`, then it will constrain it to versions `[1.5.0, 1.6.0)`. But that seems a bit too constrained compared to the `[1.0.0, 1.6.0)` which is what I’d like to specify.

The tilde might solve the issue with the auto merge to the General registry, though. I’ll try it out.

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [May 13, 2023, 10:51pm UTC](https://discourse.julialang.org/t/upper-bound-for-minor-version-of-a-dependency/98816/4 "2023-05-13T22:51:31Z")

</div>

You can use hyphens for an explicit range.

```julia
[compat]
PkgA = "1.2.3 - 4.5" # 1.2.3 - 4.5.* = [1.2.3, 4.6.0)
PkgA = "1.2.3 - 4" # 1.2.3 - 4.*.* = [1.2.3, 5.0.0)
PkgA = "1.2 - 4.5" # 1.2.0 - 4.5.* = [1.2.0, 4.6.0)
PkgA = "1.2 - 4" # 1.2.0 - 4.*.* = [1.2.0, 5.0.0)
PkgA = "1 - 4.5" # 1.0.0 - 4.5.* = [1.0.0, 4.6.0)
PkgA = "1 - 4" # 1.0.0 - 4.*.* = [1.0.0, 5.0.0)
PkgA = "0.2.3 - 4.5" # 0.2.3 - 4.5.* = [0.2.3, 4.6.0)
PkgA = "0.2.3 - 4" # 0.2.3 - 4.*.* = [0.2.3, 5.0.0)
PkgA = "0.2 - 4.5" # 0.2.0 - 4.5.* = [0.2.0, 4.6.0)
PkgA = "0.2 - 4" # 0.2.0 - 4.*.* = [0.2.0, 5.0.0)
PkgA = "0.2 - 0.5" # 0.2.0 - 0.5.* = [0.2.0, 0.6.0)
PkgA = "0.2 - 0" # 0.2.0 - 0.*.* = [0.2.0, 1.0.0)

```

[https://pkgdocs.julialang.org/v1/compatibility/#Hyphen-specifiers](https://pkgdocs.julialang.org/v1/compatibility/#Hyphen-specifiers)

---

<div class="post-metadata">

### Author: ![ferrolho](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ferrolho/32/213665_2.png) [@ferrolho](https://discourse.julialang.org/u/ferrolho)
#### Post date: [May 13, 2023, 10:51pm UTC](https://discourse.julialang.org/t/upper-bound-for-minor-version-of-a-dependency/98816/5 "2023-05-13T22:51:44Z")

</div>

Ah yes, I think `X = "1 - 1.5"` works! Thank you! 😃

---

<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: [May 14, 2023, 8:03am UTC](https://discourse.julialang.org/t/upper-bound-for-minor-version-of-a-dependency/98816/6 "2023-05-14T08:03:51Z")

</div>

You don’t need it now that you have solved it but a convenient way to get working compat is to use [GitHub - GunnarFarneback/PackageCompatUI.jl: Terminal UI for [compat] section of Julia Project.toml files.](https://github.com/GunnarFarneback/PackageCompatUI.jl)

---

<div class="post-metadata">

### Author: ![ferrolho](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ferrolho/32/213665_2.png) [@ferrolho](https://discourse.julialang.org/u/ferrolho)
#### Post date: [May 14, 2023, 8:12am UTC](https://discourse.julialang.org/t/upper-bound-for-minor-version-of-a-dependency/98816/7 "2023-05-14T08:12:49Z")

</div>

Interesting. Thanks for sharing!
