elan
elan copied to clipboard
RFC: Upgrading Lean versions
Suggested plan:
- Inject a
leanpkg lean-upgrade <version>
command intoleanpkg
(i.e. it will only be available when calling~/.elan/bin/leanpkg
). This is not just a convenience command for editing theleanpkg.toml
file: It first has to resolve channel names likestable/nightly
to specific Lean versions that are valid values for thelean_version
field. - Override
leanpkg add
andleanpkg upgrade
to add a warning onlean_version
mismatches between the package and its dependencies. When connected to a TTY, offer to calllean-upgrade
with an appropriate version to fix the conflicts (well, at least one of them).
With these changes, installing Lean and adding a mathlib dependency could be as simple as:
$ curl https://raw.githubusercontent.com/Kha/elan/master/elan-init.sh -sSf | sh
...
$ leanpkg new mypackage # uses stable leanpkg, doesn't matter
$ cd mypackage
$ leanpkg add leanprover/mathlib
...
WARNING: Lean version "nightly-2018-04-06" of dependency "mathlib" does not match configured Lean version "3.4.0"
Do you want to set your package's Lean version to "nightly-2018-04-06"? [yN] y
...
What would you do when you add a second package that specifies a different version of Lean?
What would you do when you add a second package that specifies a different version of Lean?
Select "an appropriate version", as I said :grin: . ...probably the lexically largest version string or something
Sorry! I must have missed that!