Skip to content

Commit

Permalink
Add example with range of versions
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer authored Mar 17, 2024
1 parent a7a44d1 commit fdf6bb1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion docs/src/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ 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)
```

### Checking specification
### Checking specifications

Pkg.jl parses a given version specification using `Pkg.Versions.semver_spec`.
You can check if a particular version of a package is contained in a particular
Expand All @@ -184,6 +184,19 @@ false

julia> v"0.3.3" in Pkg.Versions.semver_spec("0.1 - 0.2, ~0.3.2")
true

julia> # Grid of versions:
versions = [[VersionNumber(major, minor, patch) for patch=0:8, minor=0:3, major=0:1]...];

julia> filter(v -> v in Pkg.Versions.semver_spec("0.1.8 - 0.2.2, ^0.3.6"), versions)
7-element Vector{VersionNumber}:
v"0.1.8"
v"0.2.0"
v"0.2.1"
v"0.2.2"
v"0.3.6"
v"0.3.7"
v"0.3.8"
```

## Fixing conflicts
Expand Down

0 comments on commit fdf6bb1

Please sign in to comment.