8000 feat: server support for new module setup by tydeu · Pull Request #8699 · leanprover/lean4 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: server support for new module setup #8699

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 8 commits into from
Jun 23, 2025
Merged

Conversation

tydeu
Copy link
Member
@tydeu tydeu commented Jun 10, 2025

This PR adds support to the server for the new module setup process by changing how lake setup-file is used.

In the new server setup, lake setup-file is invoked with the file name of the edited module passed as a CLI argument and with the parsed header passed to standard input in JSON form. Standard input is used to avoid potentially exceeding the CLI length limits on Windows. Lake will build the module's imports along with any other dependencies and then return the module's workspace configuration via JSON (now in the form of ModuleSetup). The server then post-processes this configuration a bit and returns it back to the Lean language processor.

The server's header is currently only fully respected by Lake for external modules (files that are not part of any workspace library). For workspace modules, the saved module header is currently used to build imports (as has been done since #7909). A follow-up Lake PR will align both cases to follow the server's header.

Lean search paths (e.g., LEAN_PATH, LEAN_SRC_PATH) are no longer negotiated between the server and Lake. These environment variables are already configured during sever setup by lake serve and do not change on a per-file basis. Lake can also pre-resolve the .olean files of imports via the importArts field of ModuleSetup, limiting the potential utility of communicating LEAN_PATH.

@tydeu tydeu requested a review from mhuisi as a code owner June 10, 2025 02:50
@tydeu tydeu added the changelog-server Language server, widgets, and IDE extensions label Jun 10, 2025
@tydeu tydeu marked this pull request as draft June 10, 2025 03:30
@tydeu
Copy link
Member Author
tydeu commented Jun 11, 2025

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit 27b9014.
There were significant changes against commit 8422d93:

  Benchmark       Metric       Change
  ==============================================
+ bv_decide_mod   task-clock    -2.1%  (-31.8 σ)
+ bv_decide_mod   wall-clock    -2.2% (-206.6 σ)
- rbmap_library   task-clock     6.9%   (44.1 σ)
- rbmap_library   wall-clock     6.9%   (36.0 σ)

@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jun 18, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jun 18, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Jun 18, 2025
@leanprover-community-bot leanprover-community-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Jun 18, 2025
@leanprover-community-bot
Copy link
Collaborator
leanprover-community-bot commented Jun 18, 2025

Mathlib CI status (docs):

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jun 19, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Jun 19, 2025
@leanprover-community-bot leanprover-community-bot added builds-mathlib CI has verified that Mathlib builds against this PR and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels Jun 19, 2025
@tydeu tydeu marked this pull request as ready for review June 19, 2025 18:41
@tydeu tydeu requested a review from Kha as a code owner June 19, 2025 18:41
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jun 19, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Jun 19, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jun 23, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Jun 23, 2025
@leanprover-community-bot leanprover-community-bot added breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan and removed builds-mathlib CI has verified that Mathlib builds against this PR labels Jun 23, 2025
@tydeu tydeu added this pull request to the merge queue Jun 23, 2025
@tydeu tydeu removed this pull request from the merge queue due to a manual request Jun 23, 2025
@tydeu tydeu added this pull request to the merge queue Jun 23, 2025
Merged via the queue into leanprover:master with commit dd64678 Jun 23, 2025
24 checks passed
@tydeu tydeu deleted the server-setup branch June 23, 2025 20:04
wkrozowski pushed a commit to wkrozowski/lean4 that referenced this pull request Jun 24, 2025
This PR adds support to the server for the new module setup process by
changing how `lake setup-file` is used.

In the new server setup, `lake setup-file` is invoked with the file name
of the edited module passed as a CLI argument and with the parsed header
passed to standard input in JSON form. Standard input is used to avoid
potentially exceeding the CLI length limits on Windows. Lake will build
the module's imports along with any other dependencies and then return
the module's workspace configuration via JSON (now in the form of
`ModuleSetup`). The server then post-processes this configuration a bit
and returns it back to the Lean language processor.

The server's header is currently only fully respected by Lake for
external modules (files that are not part of any workspace library). For
workspace modules, the saved module header is currently used to build
imports (as has been done since leanprover#7909). A follow-up Lake PR will align
both cases to follow the server's header.

Lean search paths (e.g., `LEAN_PATH`, `LEAN_SRC_PATH`) are no longer
negotiated between the server and Lake. These environment variables are
already configured during sever setup by `lake serve` and do not change
on a per-file basis. Lake can also pre-resolve the `.olean` files of
imports via the `importArts` field of `ModuleSetup`, limiting the
potential utility of communicating `LEAN_PATH`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan changelog-server Language server, widgets, and IDE extensions toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0