Skip to content
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

doc: add tips about lake usage #510

Open
wants to merge 10 commits into
base: lean4
Choose a base branch
from

Conversation

joneugster
Copy link
Contributor

@joneugster joneugster commented Aug 2, 2024

Adding some notes about custom setups that are possible with a lakefile.lean, in particular how to use a single shared mathlib in multiple projects.

This might be useful for people with little disk space as well as for teaching setups where it might be reasonable to have a single mathlib on a shared drive and then have students reference this instead of downloading their own copy.

@joneugster joneugster changed the title doc: add tips about lake usage. doc: add tips about lake usage Aug 2, 2024
Copy link
Contributor

@grunweg grunweg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing this! I have a left minor comments, mostly about copy-editing/grammar.

templates/install/tricks.md Outdated Show resolved Hide resolved
templates/install/tricks.md Outdated Show resolved Hide resolved
templates/install/tricks.md Outdated Show resolved Hide resolved
templates/install/tricks.md Outdated Show resolved Hide resolved
templates/install/tricks.md Outdated Show resolved Hide resolved
templates/install/tricks.md Outdated Show resolved Hide resolved
templates/install/tricks.md Outdated Show resolved Hide resolved
templates/install/tricks.md Outdated Show resolved Hide resolved
templates/install/tricks.md Outdated Show resolved Hide resolved
templates/install/tricks.md Outdated Show resolved Hide resolved
@joneugster
Copy link
Contributor Author

joneugster commented Sep 5, 2024

Thank you @grunweg for the review! I completely forgot this PR, but now I've addressed all your suggestions

Copy link

@tydeu tydeu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR was mentioned again on Zulip today, so I thought I should take another look. Below are some comments I had on on the shared mathlib section. In regards to the local versions section, the next version of Lake should, hopefully, have some built-in support local versions of dependency, making that section much less hacky. :-)

Comment on lines +57 to +61
```bash
rm -rf .lake # because `lake clean` does not remove `.lake/packages/mathlib` which might have been downloaded by `lake new`.
lake clean # or potentially `lake update -R mathlib` instead
```
*(note: it looks like a bug that with a simple `lake clean`, there might still be a folder `.lake/packages/mathlib` floating around from before you changed the `lakefile.lean`. However, deleting `.lake/` is a reasonably safe action as it only contains build artifacts that are fully recovered by the next `lake` call.)*
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```bash
rm -rf .lake # because `lake clean` does not remove `.lake/packages/mathlib` which might have been downloaded by `lake new`.
lake clean # or potentially `lake update -R mathlib` instead
```
*(note: it looks like a bug that with a simple `lake clean`, there might still be a folder `.lake/packages/mathlib` floating around from before you changed the `lakefile.lean`. However, deleting `.lake/` is a reasonably safe action as it only contains build artifacts that are fully recovered by the next `lake` call.)*
```bash
lake update -R mathlib # use the new path for mathlib
rm -rf .lake/packages/mathlib # delete the previous local clone of mathlib
```

lake update -R mathlib should be enough to switch to the relative mathlib. If not, that is a bug. Also, lake clean does not delete Lake packages, it merely removes build outputs.

Comment on lines +63 to +71
6) When you updated your global mathlib it might be enough to call
```
lake update -R mathlib
```
which would in theory update everything automatically.
However, if there are breaking changes to the `lakefile` parsing, you might need to
* edit `lean-toolchain` to be the same as your global mathlib.
* make sure `lakefile.lean` parses without error in the new version.
* try `lake update -R mathlib` again.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
6) When you updated your global mathlib it might be enough to call
```
lake update -R mathlib
```
which would in theory update everything automatically.
However, if there are breaking changes to the `lakefile` parsing, you might need to
* edit `lean-toolchain` to be the same as your global mathlib.
* make sure `lakefile.lean` parses without error in the new version.
* try `lake update -R mathlib` again.
6) Updating your global mathlib should, in theory, update everything automatically.
However, if there are breaking changes to the `lakefile` parsing, you might need to
* edit `lean-toolchain` to be the same as your global mathlib.
* make sure `lakefile.lean` parses without error in the new version.
* try whatever broke again.

You should not need to lake update a relative dependency. (as path dependencies are not versioned).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants