-
Notifications
You must be signed in to change notification settings - Fork 689
feat: lake: require dependencies by semver range #10959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+724
−44
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
02bbf04 to
d7eed48
Compare
|
Reference manual CI status:
|
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Oct 26, 2025
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Oct 26, 2025
|
Mathlib CI status (docs):
|
d7eed48 to
4692410
Compare
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Nov 2, 2025
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Nov 2, 2025
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Nov 3, 2025
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Nov 3, 2025
f3b73d0 to
945144b
Compare
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Nov 3, 2025
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Nov 3, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
builds-mathlib
CI has verified that Mathlib builds against this PR
changelog-lake
Lake
toolchain-available
A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables Lake users to require Reservoir dependencies by a semantic version range. On a
lake update, Lake will fetch the package's version information from Reservoir and select the newest version of the package that satisfies the range.Using Version Ranges
Version ranges can be specified through the
versionfield of a TOMLrequireor the@clause of a Leanrequire. They are only meaningful on Reservoir dependencies.lakefile.lean
lakefile.toml
The syntax for these versions ranges is a mix of Rust's and Node's with some Lean-friendly deviations.
Comparators
The basic unit of semantic version ranges are version comparators. They take a base version and a comparison operator and match versions which compare positively with their base. Lake supports the following comparison operators.
<,<=/≤,>,>=/≥,=,!=/≠Unlike Rust and Node, Lake supports Unicode alternatives for the operators. It also adds the not-equal operator (
!=/≠) to make excluding broken versions easier.Comparators can be combined into clauses via conjunction or disjunction:
≥1.2.3, <1.8.0or Node-style1.2.3 <1.8.01.2.7 || >=1.2.9, <2.0.0When the base version of a comparator has a
-suffix (e.g.,>1.2.3-alpha.3) it will match versions of the same core (1.2.3) with suffixes that lexicographically compare (e.g.,1.2.3-alpha.7or1.2.3-beta.2) but will not match suffixed versions of different cores (e.g.,3.4.5-rc5). An empty-suffix can be used to disable this behavior. For example,<2.0.0-will match1.2.3-beta.2and2.0.0-alpha.1.Range Macros
In addition to the basic comparators, Lake also supports standard shorthand for specifying more complex ranges. Namely, it supports the caret (
^) and tilde (~) operator along with wildcard ranges.Caret Ranges
^1=>≥1.0.0, <2.0.0-^1.2=>≥1.2.0, <2.0.0-^1.2.3=>≥1.2.3, <2.0.0-^1.2.3-beta.2=>≥1.2.3-beta.2, <2.0.0-^0.2=>≥0.0.0, <0.3.0-^0.2.3=>≥0.2.3, <0.3.0-^0.0.3=>≥0.0.3, <0.0.4-^0=>≥0.0.0, <1.0.0-^0.0=>≥0.0.0, <0.1.0-Tilde Ranges
~1=>≥1.0.0, <2.0.0-~1.2=>≥1.2.0, <1.3.0-~1.2.3=>≥1.2.3, <1.3.0-~1.2.3-beta.2=>≥1.2.3-beta.2, <1.3.0-^0=>≥0.0.0, <1.0.0-^0.2.3=>≥0.2.3, <0.3.0-^0.0.3=>≥0.0.3, <0.0.4-~0=>≥0.0.0, <1.0.0-~0.0=>≥0.0.0, <0.1.0-~0.0.0=>≥0.0.0, <0.1.0-Wildcard Ranges
*=>≥0.0.01.x=>≥1.0.0, <2.0.0-1.*.x=>≥1.0.0, <2.0.0-1.2.*=>≥1.2.0, <1.3.0-These ranges closely follow Rust's and Node's syntax. Like Node but unlike Rust, wildcard ranges support
xandXas alternative syntax for wildcards.