Zulip Chat Archive

Stream: general

Topic: deleting lakefile.olean


Jon Eugster (Nov 09 2023 at 17:59):

@Mac Malone , I wonder if lake update (and lake clean) should always delete the lakefile.olean and recreate it?

Before the introduction of the lakefile.olean I had an env variable to switch between a local copy of a dependency or downloading it. As expected, when calling lake update, it would reevaluate the lakefile, choose the right one and update the lake-manifest.json. Now, however, lake update does nothing and I have to resort to rm lakefile.olean && lake update to get a "clean" update. My understanding is that lakefile.olean is a performance optimisation when calling lake (e.g. lake build etc). However, I believe lake update (and lake clean) is only rarely used and getting a consistent result would be much more important than performance.

Here's the relevant lakefile:

Example

Mac Malone (Nov 09 2023 at 21:03):

@Jon Eugster A cleaner alternative to rm lakefile.olean && lake update is lake update -R (where -R is short for --reconfigure).

Whether re-elaborating the file should be the default for lake update and lake clean is curious question. From a purely performance angel, you are right that the time save is probably doesn't matter to much for commands like lake update and lake clean that are unlikely to invoked frequently. However, lakefile.olean is not purely a performance optimization, it also saves the Lake configuration options (e.g. -K) and other environment-based state. In your case, you do not want that, but in other circumstances this can be quite useful (e.g., to fix a state to be used by the Lean language server in VS Code.)

I am inclined to believe that do the fast thing by default and the slower thing by request (via -R) is generally a good default. However, I am open to being persuaded otherwise.

Mario Carneiro (Nov 09 2023 at 21:12):

I continue to be hit by olean compatibility issues with lakefile.olean, especially in lean 4 core. I'm hoping your recent work on tightening this up will help, but I'd rather have stable behavior at the cost of some performance loss

Scott Morrison (Nov 09 2023 at 23:56):

Moreover, saving state in an olean seems like a dangerous idea to begin with, especially if you need to know magic options to clean to reset it!

Jon Eugster (Nov 10 2023 at 00:08):

Thanks, -R is indeed useful!

Jon Eugster (Nov 14 2023 at 19:04):

Jon Eugster said:

Before the introduction of the lakefile.olean I had an env variable to switch between a local copy of a dependency or downloading it.

I just realised staring at mathlib's lakefile, that rather than setting an environment variable, the "intended way" would probably be to use the -K that Mac mentions above: lake update -K my.config.option -R and then if get_config? my.config.option |>.isSome then _ else _inside the lakefile.lean. Still needs the -R to have any effect.

I couldn't find -K in the lake docs yet, although it does appear under lake --help. Therefore I thought I leave a note to future me here.


Last updated: Dec 20 2023 at 11:08 UTC