leanprover / leanprover/lean4

feat: lake flag to skip dependency materialization (offline/bundled use)

Open
#13,101 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Lake P-low
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

We're building a tool to create self-contained offline bundles of Lean 4 projects for teaching (https://github.com/leanprover-community/bundle, discussed at https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/trylean.20bundle.20for.20lean4). The idea is that students download a zip, unpack it, and have a working Lean setup with no network access and no git.

Currently lake build --no-build always runs materializeDeps, which runs git commands for every git-type dependency in the manifest, even though --no-build implies we believe everything is already in place. This means lake build --no-build can't be used offline if the manifest has git deps.

It would be great to have a flag (e.g. --offline or --no-fetch) that tells Lake to skip all git operations during dependency resolution. The semantics would be: trust that .lake/packages/ already contains the right sources, and just load the workspace from what's on disk.

Workaround

Our current workaround is to rewrite lake-manifest.json in the bundle, converting all "type": "git" entries to "type": "path" pointing at the local .lake/packages/ directories. validateManifest only warns on the source-kind mismatch, so this works, but it's hackish and means the manifest no longer reflects how the project was actually built.

Context

This came up while working on the discussion at https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/trylean.20bundle.20for.20lean4. Patrick Massot and other teachers need bundles that work without git, network access, or any installation.

See also #12901 which describes a related problem (Lake deleting packages before verifying fetch succeeds).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Lake code path where lake build --no-build invokes materializeDeps, and review how git-type entries are handled during dependency resolution. Define the offline flag's behavior around existing .lake/packages/ sources, then verify that builds avoid git operations while still loading the workspace and manifest correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
build-system, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.