lean-runtime 2.3.0__tar.gz → 2.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/CHANGELOG.md +51 -0
- {lean_runtime-2.3.0/lean_runtime.egg-info → lean_runtime-2.5.0}/PKG-INFO +50 -6
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/README.md +48 -5
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/architecture.md +23 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/cli.md +35 -2
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/environments.md +14 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/getting-started.md +36 -1
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/index.md +7 -4
- lean_runtime-2.5.0/docs/local-projects.md +162 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/portable-copies.md +22 -6
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/project-publishing.md +13 -8
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/python-api.md +22 -3
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/trust-and-limitations.md +17 -5
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/__init__.py +16 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/bundles.py +517 -1
- lean_runtime-2.5.0/lean_runtime/capsules.py +530 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/cli.py +310 -16
- lean_runtime-2.5.0/lean_runtime/console.py +246 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/api.py +3 -3
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/probe.py +10 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/environments.py +145 -22
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/errors.py +9 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/events.py +28 -3
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/oci.py +529 -10
- lean_runtime-2.5.0/lean_runtime/packs.py +380 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/policies.py +42 -0
- lean_runtime-2.5.0/lean_runtime/project_sharing.py +536 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/projects.py +3 -1
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/resolver.py +36 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/run_cli.py +144 -35
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/runtime.py +587 -15
- lean_runtime-2.5.0/lean_runtime/shared_projects.py +741 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/store.py +208 -5
- lean_runtime-2.5.0/lean_runtime/toolchain_oci.py +498 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/toolchain_slim.py +55 -18
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/toolchains.py +7 -1
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/verification.py +55 -6
- {lean_runtime-2.3.0 → lean_runtime-2.5.0/lean_runtime.egg-info}/PKG-INFO +50 -6
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime.egg-info/SOURCES.txt +10 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime.egg-info/requires.txt +1 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/mkdocs.yml +1 -1
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/pyproject.toml +2 -2
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/scripts/announcement_gate.py +117 -16
- lean_runtime-2.5.0/scripts/registry_preflight.py +184 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/scripts/smoke_wheel.py +1 -1
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/discovery/test_engine.py +4 -2
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_bundles.py +372 -2
- lean_runtime-2.5.0/tests/test_capsules.py +250 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_cli.py +95 -0
- lean_runtime-2.5.0/tests/test_console.py +251 -0
- lean_runtime-2.5.0/tests/test_packs.py +82 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_project_publish.py +1 -1
- lean_runtime-2.5.0/tests/test_projects.py +684 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_run_cli.py +146 -4
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_runtime.py +22 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_store.py +82 -1
- lean_runtime-2.5.0/tests/test_toolchain_oci.py +86 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_toolchain_slim.py +28 -3
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_verification_probe.py +41 -2
- lean_runtime-2.3.0/docs/local-projects.md +0 -58
- lean_runtime-2.3.0/scripts/registry_preflight.py +0 -156
- lean_runtime-2.3.0/tests/test_projects.py +0 -162
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/LICENSE +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/MANIFEST.in +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/catalog/environments.toml +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/catalog/locks/core-v4.32.2.lock.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/catalog/locks/leancert-v4.30.0.5.lock.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/catalog/locks/leancert-v4.31.0.lock.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/catalog/locks/leancert-v4.32.2.4.lock.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/catalog/locks/leancert-v4.33.0.lock.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/catalog/locks/mathlib-v4.30.0.lock.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/catalog/locks/mathlib-v4.31.0.lock.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/catalog/locks/mathlib-v4.32.2.lock.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/catalog/locks/mathlib-v4.33.0.lock.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/compatibility/README.md +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/compatibility/mathlib-4.32.2.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/compatibility/mathlib-4.32.2.toml +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/compatibility/mathlib-4.33.0.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/compatibility/mathlib-4.33.0.toml +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/captures.md +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/case-study-v1.md +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/development.md +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/ready-programs.md +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/standalone-files.md +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/docs/v1-precision.md +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/examples/mathlib.toml +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/__main__.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/_git.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/_paths.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/backends.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/comparison.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/decisions.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/diagnostics.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/__init__.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/analyzer.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/candidate.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/catalog.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/catalog_build.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/catalog_cli.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/catalog_manifest.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/data/catalog.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/defaults.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/engine.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/errors.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/module_inventory.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/planner.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/policy.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/py.typed +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/result.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/schema_resources.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/schemas/catalog-v1.schema.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/schemas/plan-v1.schema.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/discovery/schemas/result-v1.schema.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/facade.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/frontmatter.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/health.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/lake.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/lockfiles.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/locking.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/matrix.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/models.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/profiling.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/programs.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/publisher_verification.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/py.typed +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/references.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/schema_resources.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/serialization.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/specs.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/timings.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime/wire.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime.egg-info/dependency_links.txt +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime.egg-info/entry_points.txt +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/lean_runtime.egg-info/top_level.txt +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/schemas/cleanup-v1.schema.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/schemas/comparison-v1.schema.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/schemas/execution-v1.schema.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/schemas/inspect-v1.schema.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/schemas/matrix-v1.schema.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/schemas/profile-v1.schema.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/schemas/verify-v1.schema.json +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/scripts/run_compatibility.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/scripts/run_v1_case_study.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/setup.cfg +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/conftest.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/discovery/e2e/test_real_discovery.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/discovery/test_analyzer.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/discovery/test_catalog.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/discovery/test_catalog_build.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/discovery/test_discovery_schema_resources.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/discovery/test_planner.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/discovery/test_policy.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_backend.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_diagnostics.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_environment_integration.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_events_health.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_facade.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_frontmatter.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_git.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_interactive.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_lockfiles.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_models.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_multifile.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_paths.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_prebuilt_policy.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_programs.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_references.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_schema_resources.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_schemas.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_signatures.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_specs.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_toolchains.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_v1_precision.py +0 -0
- {lean_runtime-2.3.0 → lean_runtime-2.5.0}/tests/test_verification_inventory.py +0 -0
|
@@ -2,6 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 2.5.0 - 2026-08-14
|
|
6
|
+
|
|
7
|
+
- Make `lean-runtime init` create a concise `AGENTS.md` with build, checking,
|
|
8
|
+
and shared-dependency safety instructions by default. `--no-agents` opts out,
|
|
9
|
+
and existing guides are preserved.
|
|
10
|
+
- Make `scripts/release.sh` provision an isolated release environment and allow
|
|
11
|
+
safe retries after a pre-tag failure instead of depending on undeclared
|
|
12
|
+
packages in the invoking Python environment.
|
|
13
|
+
|
|
14
|
+
- Add shared Lake project onboarding and migration. `lean-runtime init` creates
|
|
15
|
+
a standard core or cataloged-Mathlib project; `attach` previews or
|
|
16
|
+
transactionally adopts one project or an entire recursive tree; and `detach`
|
|
17
|
+
materializes independent copies again. Adoption preserves root build output,
|
|
18
|
+
rejects dirty or mismatched dependencies, verifies both generated overrides
|
|
19
|
+
and ordinary Lake package links, and rolls back failed swaps. Attached
|
|
20
|
+
projects automatically use shared mode in `lean-runtime build`.
|
|
21
|
+
- Add content-addressed Lake dependency workspaces. Each exact package is reused
|
|
22
|
+
across root manifests when its effective transitive closure, toolchain, and
|
|
23
|
+
platform match. Concurrent runtime builds are serialized, existing clean
|
|
24
|
+
artifacts seed the store with copy-on-write clones, and local Git object
|
|
25
|
+
databases seed other revisions without another network clone. Plain
|
|
26
|
+
`build --shared` never modifies the checkout; only explicit
|
|
27
|
+
`attach --execute` removes verified generated duplicates.
|
|
28
|
+
|
|
29
|
+
- Add versioned check capsules: publisher-built manifests record every retained
|
|
30
|
+
module facet, exact import edges, content digest, package owner, and
|
|
31
|
+
capability. Publication now fails unless the full environment and a
|
|
32
|
+
physically isolated capsule both accept the locked public import.
|
|
33
|
+
- Replace monolithic environment pulls with deterministic seekable zstd packs.
|
|
34
|
+
A clean check downloads only the pack frames covering its transitive import
|
|
35
|
+
closure; verified raw artifacts are shared in a cross-environment CAS and
|
|
36
|
+
projected atomically. `lean-run --plan` reports closure and check-runtime
|
|
37
|
+
costs before transfer, and `--max-download` gates their combined known cost.
|
|
38
|
+
- Publish independently verified check-only Lean toolchains through the same
|
|
39
|
+
multi-platform OCI library. Consumers prefer the slim signed runtime before
|
|
40
|
+
installing the full official toolchain, while retaining an Elan fallback for
|
|
41
|
+
libraries that have not published the new artifact yet.
|
|
42
|
+
- Add explicit sparse capabilities. Batch checking includes every olean facet
|
|
43
|
+
and IR file Lean actually requires; editor indexes are acquired only when
|
|
44
|
+
requested. Native/development requests fail with an actionable full-build
|
|
45
|
+
requirement instead of pretending that a check capsule supports them.
|
|
46
|
+
- Make project export source-free and closure-scoped. `project export` now
|
|
47
|
+
creates a portable sparse capsule, and `open-copy` verifies its OCI digest
|
|
48
|
+
chain, per-artifact CAS hashes, exact lock/platform identity, and Lean probe
|
|
49
|
+
before publishing it locally.
|
|
50
|
+
- Include shared sparse artifacts in `lean-runtime storage` and safely reclaim
|
|
51
|
+
old unleased CAS entries with `clean --include-downloads`.
|
|
52
|
+
- Make releases tag-driven and fail closed: the helper waits for CI on the exact
|
|
53
|
+
release commit; the tag workflow independently checks version, changelog,
|
|
54
|
+
tests, docs, wheel metadata, and wheel installation; PyPI must succeed before
|
|
55
|
+
the GitHub release is created.
|
|
5
56
|
- Extend the bundled catalog through Mathlib v4.33.0 and add exact LeanCert
|
|
6
57
|
environments for the supported Lean 4.30, 4.31, 4.32, and 4.33 lines.
|
|
7
58
|
Otherwise-equivalent discovery candidates now prefer the smallest exact
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lean-runtime
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0
|
|
4
4
|
Summary: Run Lean 4 proofs from Python or standalone files
|
|
5
5
|
Author: Alejandro Radisic
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -22,6 +22,7 @@ Requires-Python: >=3.10
|
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
24
|
Requires-Dist: tomli>=2; python_version < "3.11"
|
|
25
|
+
Requires-Dist: zstandard<1,>=0.23
|
|
25
26
|
Provides-Extra: dev
|
|
26
27
|
Requires-Dist: pytest>=8; extra == "dev"
|
|
27
28
|
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
@@ -90,6 +91,21 @@ environment libraries, then builds the exact source environment when necessary.
|
|
|
90
91
|
`--no-source-build` to forbid that potentially large fallback or `--offline` to use
|
|
91
92
|
retained environments only.
|
|
92
93
|
|
|
94
|
+
Before a cold run, inspect its cost without changing the store:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
lean-run Main.lean --plan
|
|
98
|
+
lean-run Main.lean --max-download 2GiB
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
New-format libraries publish two independently verified pieces: a slim Lean
|
|
102
|
+
check runtime and seekable module packs. Lean Runtime computes the source's
|
|
103
|
+
transitive import closure, downloads only the corresponding compressed frames,
|
|
104
|
+
and shares verified module artifacts across Mathlib, LeanCert, and future
|
|
105
|
+
environments. A warm check is silent apart from its result. Older published
|
|
106
|
+
environments remain readable and automatically use the legacy full-bundle
|
|
107
|
+
path, so this optimization does not invalidate existing locks.
|
|
108
|
+
|
|
93
109
|
Explicit frontmatter remains available when the desired context is already known:
|
|
94
110
|
|
|
95
111
|
```lean
|
|
@@ -165,6 +181,32 @@ project = lean.setup(project="./my-project")
|
|
|
165
181
|
result = project.check_file("./my-project/MyProject/Main.lean")
|
|
166
182
|
```
|
|
167
183
|
|
|
184
|
+
Create a normal Lake project whose exact dependencies are shared automatically:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
lean-runtime init MyProof --mathlib
|
|
188
|
+
cd MyProof
|
|
189
|
+
lean-runtime build .
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
`init` also writes an `AGENTS.md` with the project build, checking, dependency,
|
|
193
|
+
and shared-package rules for coding agents. Pass `--no-agents` to omit it; an
|
|
194
|
+
existing `AGENTS.md` is never overwritten.
|
|
195
|
+
|
|
196
|
+
Existing repositories can preview and adopt the same layout individually or in
|
|
197
|
+
bulk:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
lean-runtime attach ~/research --recursive
|
|
201
|
+
lean-runtime attach ~/research --recursive --execute
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The dry run reports blockers and estimated recovery without changing anything.
|
|
205
|
+
Adoption preserves each root `.lake/build`, verifies both the override and
|
|
206
|
+
ordinary Lake views, then replaces only generated package copies with links to
|
|
207
|
+
the content-addressed store. `lean-runtime detach . --execute` materializes an
|
|
208
|
+
independent project again.
|
|
209
|
+
|
|
168
210
|
One-shot helpers are available when setup reuse is unnecessary:
|
|
169
211
|
|
|
170
212
|
```python
|
|
@@ -217,7 +259,9 @@ lean-runtime project init-publish . \
|
|
|
217
259
|
```
|
|
218
260
|
|
|
219
261
|
The workflow builds and verifies Linux and macOS environments, finalizes the
|
|
220
|
-
|
|
262
|
+
environment and slim-toolchain indexes atomically, then checks clean consumers.
|
|
263
|
+
For a one-machine handoff, `lean-runtime project export` writes a source-free
|
|
264
|
+
portable capsule containing only the selected public module's closure. See
|
|
221
265
|
[Publishing a Lean project](https://alerad.github.io/lean-runtime/project-publishing/).
|
|
222
266
|
|
|
223
267
|
For an already-built executable, Lean Runtime can also create a verified
|
|
@@ -229,10 +273,10 @@ library. See [Ready-to-run programs](https://github.com/alerad/lean-runtime/blob
|
|
|
229
273
|
|
|
230
274
|
The simple API is backed by exact Git commits and trees, Lake-resolved locks,
|
|
231
275
|
platform-aware content-addressed environments, atomic cross-process builds,
|
|
232
|
-
downloadable environment reuse,
|
|
233
|
-
publishers. The libraries use
|
|
234
|
-
|
|
235
|
-
architecture documentation.
|
|
276
|
+
downloadable environment reuse, sparse content-addressed module packs,
|
|
277
|
+
replayable provenance, verification, and trusted publishers. The libraries use
|
|
278
|
+
OCI-compatible storage internally, but users do not need Docker or container
|
|
279
|
+
concepts. Advanced protocol details remain in the architecture documentation.
|
|
236
280
|
|
|
237
281
|
## Documentation
|
|
238
282
|
|
|
@@ -55,6 +55,21 @@ environment libraries, then builds the exact source environment when necessary.
|
|
|
55
55
|
`--no-source-build` to forbid that potentially large fallback or `--offline` to use
|
|
56
56
|
retained environments only.
|
|
57
57
|
|
|
58
|
+
Before a cold run, inspect its cost without changing the store:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
lean-run Main.lean --plan
|
|
62
|
+
lean-run Main.lean --max-download 2GiB
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
New-format libraries publish two independently verified pieces: a slim Lean
|
|
66
|
+
check runtime and seekable module packs. Lean Runtime computes the source's
|
|
67
|
+
transitive import closure, downloads only the corresponding compressed frames,
|
|
68
|
+
and shares verified module artifacts across Mathlib, LeanCert, and future
|
|
69
|
+
environments. A warm check is silent apart from its result. Older published
|
|
70
|
+
environments remain readable and automatically use the legacy full-bundle
|
|
71
|
+
path, so this optimization does not invalidate existing locks.
|
|
72
|
+
|
|
58
73
|
Explicit frontmatter remains available when the desired context is already known:
|
|
59
74
|
|
|
60
75
|
```lean
|
|
@@ -130,6 +145,32 @@ project = lean.setup(project="./my-project")
|
|
|
130
145
|
result = project.check_file("./my-project/MyProject/Main.lean")
|
|
131
146
|
```
|
|
132
147
|
|
|
148
|
+
Create a normal Lake project whose exact dependencies are shared automatically:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
lean-runtime init MyProof --mathlib
|
|
152
|
+
cd MyProof
|
|
153
|
+
lean-runtime build .
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`init` also writes an `AGENTS.md` with the project build, checking, dependency,
|
|
157
|
+
and shared-package rules for coding agents. Pass `--no-agents` to omit it; an
|
|
158
|
+
existing `AGENTS.md` is never overwritten.
|
|
159
|
+
|
|
160
|
+
Existing repositories can preview and adopt the same layout individually or in
|
|
161
|
+
bulk:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
lean-runtime attach ~/research --recursive
|
|
165
|
+
lean-runtime attach ~/research --recursive --execute
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The dry run reports blockers and estimated recovery without changing anything.
|
|
169
|
+
Adoption preserves each root `.lake/build`, verifies both the override and
|
|
170
|
+
ordinary Lake views, then replaces only generated package copies with links to
|
|
171
|
+
the content-addressed store. `lean-runtime detach . --execute` materializes an
|
|
172
|
+
independent project again.
|
|
173
|
+
|
|
133
174
|
One-shot helpers are available when setup reuse is unnecessary:
|
|
134
175
|
|
|
135
176
|
```python
|
|
@@ -182,7 +223,9 @@ lean-runtime project init-publish . \
|
|
|
182
223
|
```
|
|
183
224
|
|
|
184
225
|
The workflow builds and verifies Linux and macOS environments, finalizes the
|
|
185
|
-
|
|
226
|
+
environment and slim-toolchain indexes atomically, then checks clean consumers.
|
|
227
|
+
For a one-machine handoff, `lean-runtime project export` writes a source-free
|
|
228
|
+
portable capsule containing only the selected public module's closure. See
|
|
186
229
|
[Publishing a Lean project](https://alerad.github.io/lean-runtime/project-publishing/).
|
|
187
230
|
|
|
188
231
|
For an already-built executable, Lean Runtime can also create a verified
|
|
@@ -194,10 +237,10 @@ library. See [Ready-to-run programs](https://github.com/alerad/lean-runtime/blob
|
|
|
194
237
|
|
|
195
238
|
The simple API is backed by exact Git commits and trees, Lake-resolved locks,
|
|
196
239
|
platform-aware content-addressed environments, atomic cross-process builds,
|
|
197
|
-
downloadable environment reuse,
|
|
198
|
-
publishers. The libraries use
|
|
199
|
-
|
|
200
|
-
architecture documentation.
|
|
240
|
+
downloadable environment reuse, sparse content-addressed module packs,
|
|
241
|
+
replayable provenance, verification, and trusted publishers. The libraries use
|
|
242
|
+
OCI-compatible storage internally, but users do not need Docker or container
|
|
243
|
+
concepts. Advanced protocol details remain in the architecture documentation.
|
|
201
244
|
|
|
202
245
|
## Documentation
|
|
203
246
|
|
|
@@ -114,6 +114,29 @@ renames the stage to its final identity.
|
|
|
114
114
|
Crashes cannot publish a partially ready environment. Concurrent processes
|
|
115
115
|
requesting the same identity converge on the same published directory.
|
|
116
116
|
|
|
117
|
+
## Check capsules and sparse acquisition
|
|
118
|
+
|
|
119
|
+
Publication derives a normalized capsule manifest from the authoritative full
|
|
120
|
+
build with the selected Lean version's import parser. Each module records exact
|
|
121
|
+
imports and all retained artifact facets. The publisher physically projects a
|
|
122
|
+
source-free copy and requires both the full build and that isolated projection
|
|
123
|
+
to accept the locked public import before it can upload anything.
|
|
124
|
+
|
|
125
|
+
Artifacts are grouped by package and capability into deterministic zstd packs.
|
|
126
|
+
Each pack is a sequence of independently compressed and hashed frames; the OCI
|
|
127
|
+
manifest still addresses the complete pack, while consumers use exact HTTP
|
|
128
|
+
Range requests for only the frames intersecting a source's transitive import
|
|
129
|
+
closure. Decompressed artifacts are verified into a raw-content CAS and
|
|
130
|
+
hardlinked into a growing environment projection. The generated versioned
|
|
131
|
+
`--setup` file points Lean directly at those facets, bypassing Lake and source
|
|
132
|
+
metadata during checks.
|
|
133
|
+
|
|
134
|
+
The Lean executable and core libraries use a separate multi-platform check
|
|
135
|
+
toolchain index keyed by normalized toolchain identity. Platform selection is
|
|
136
|
+
encoded only in child descriptors, so one atomic index serves Linux AMD64,
|
|
137
|
+
macOS AMD64, and macOS ARM64. Consumers verify the exact Lean commit and run a
|
|
138
|
+
capability corpus before publishing the downloaded runtime locally.
|
|
139
|
+
|
|
117
140
|
## Execution
|
|
118
141
|
|
|
119
142
|
A published build is not used as an ordinary mutable working directory. Each
|
|
@@ -109,8 +109,29 @@ stay; larger reductions require upstream facet-loading changes.
|
|
|
109
109
|
|
|
110
110
|
After pruning, source builds of *new* environments and native compilation
|
|
111
111
|
need the full toolchain again; reinstall it with `lean-runtime install`.
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
|
|
113
|
+
Libraries produced by the current publication workflow also carry this
|
|
114
|
+
verified check profile directly. A cold consumer downloads that compressed
|
|
115
|
+
profile instead of first transferring the full official release. If the
|
|
116
|
+
library has no compatible published check runtime, Lean Runtime falls back to
|
|
117
|
+
the official Elan installation path. Local `toolchain-slim` remains useful for
|
|
118
|
+
older stores and for testing a profile before publication.
|
|
119
|
+
|
|
120
|
+
## Sparse acquisition and capabilities
|
|
121
|
+
|
|
122
|
+
`lean-run FILE --plan` reads capsule metadata and reports the exact compressed
|
|
123
|
+
frames required by `FILE`'s transitive import closure, plus the selected Lean
|
|
124
|
+
check-runtime cost. The operation has no store side effects. `--max-download`
|
|
125
|
+
applies before acquisition to the combined known cost; an unknown component is
|
|
126
|
+
reported explicitly instead of treated as zero.
|
|
127
|
+
|
|
128
|
+
The ordinary check capability retains `.olean`, `.olean.server`,
|
|
129
|
+
`.olean.private`, `.ir`, and `.ir.sig`. This is empirical, not conservative
|
|
130
|
+
guesswork: Lean 4.32 and 4.33 reject ordinary imports when the corresponding
|
|
131
|
+
server/private or IR facets are omitted. `.ilean` editor indexes are a separate
|
|
132
|
+
on-demand capability through `Environment.require_capabilities(["editor"],
|
|
133
|
+
imports=[...])`. Native compilation and development builds require a full
|
|
134
|
+
environment and full toolchain; check capsules reject those requests clearly.
|
|
114
135
|
|
|
115
136
|
## Replay
|
|
116
137
|
|
|
@@ -128,6 +149,11 @@ environment can replay offline.
|
|
|
128
149
|
lean-runtime check-file Main.lean --toolchain 4.32.2
|
|
129
150
|
lean-runtime check-file ./existing-project/MyProject/Main.lean
|
|
130
151
|
lean-runtime build ./existing-project MyLibrary
|
|
152
|
+
lean-runtime init MyProof --mathlib
|
|
153
|
+
lean-runtime init MyProof --mathlib --no-agents
|
|
154
|
+
lean-runtime attach ~/research --recursive
|
|
155
|
+
lean-runtime attach ~/research --recursive --execute
|
|
156
|
+
lean-runtime detach ./existing-project --execute
|
|
131
157
|
lean-runtime install 4.32.2
|
|
132
158
|
```
|
|
133
159
|
|
|
@@ -137,6 +163,13 @@ identifier. `check-file` is the direct local-project route. When no
|
|
|
137
163
|
containing a Lake configuration and `lean-toolchain`, then passes the actual
|
|
138
164
|
project-relative file to `lake env lean`.
|
|
139
165
|
|
|
166
|
+
`init` creates a standard core or Mathlib Lake library and attaches its exact
|
|
167
|
+
cataloged dependencies. `attach` is read-only unless `--execute` is present;
|
|
168
|
+
recursive mode inventories a project tree, reports blockers and estimated disk
|
|
169
|
+
recovery, and adopts each valid project transactionally. `detach` is likewise a
|
|
170
|
+
preview unless `--execute` is present. Attached projects use shared mode by
|
|
171
|
+
default in `lean-runtime build`; detach before requesting `--local`.
|
|
172
|
+
|
|
140
173
|
Add supporting source files with repeatable `--include` options:
|
|
141
174
|
|
|
142
175
|
```bash
|
|
@@ -11,6 +11,12 @@ Lean Runtime separates three states:
|
|
|
11
11
|
The separation lets one process resolve a lock and another materialize it. A
|
|
12
12
|
completed environment can subsequently be opened offline.
|
|
13
13
|
|
|
14
|
+
Downloadable environments may use the legacy full-workspace representation or
|
|
15
|
+
the current sparse check-capsule representation. Both resolve to the same exact
|
|
16
|
+
lock and platform environment identity. A capsule stores a normalized module
|
|
17
|
+
graph and content digest for each Lean artifact; its local projection grows as
|
|
18
|
+
new imports are checked without changing that identity.
|
|
19
|
+
|
|
14
20
|
Package references are an input compiler for `EnvironmentSpec`, not another
|
|
15
21
|
environment type:
|
|
16
22
|
|
|
@@ -87,6 +93,14 @@ Short-lived execution leases prevent deletion during cloning without
|
|
|
87
93
|
serializing concurrent checks. Locks and source snapshots remain retained in
|
|
88
94
|
the current store schema.
|
|
89
95
|
|
|
96
|
+
Sparse downloads are stored once by artifact digest under the shared module
|
|
97
|
+
CAS and hardlinked into environment projections when the filesystem permits.
|
|
98
|
+
`lean-runtime storage` reports this category separately. Because it is shared,
|
|
99
|
+
its logical byte count can overlap environment projections and should not be
|
|
100
|
+
added to their logical sizes as an estimate of physical disk use.
|
|
101
|
+
`clean --include-downloads` reclaims old OCI blobs and unleased CAS artifacts;
|
|
102
|
+
per-artifact locks and recency updates prevent collection during projection.
|
|
103
|
+
|
|
90
104
|
```python
|
|
91
105
|
report = runtime.clean(dry_run=True)
|
|
92
106
|
report = runtime.clean(dry_run=False, minimum_age_seconds=30 * 24 * 60 * 60)
|
|
@@ -6,11 +6,46 @@
|
|
|
6
6
|
python -m pip install lean-runtime
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
On macOS and Linux, Lean Runtime
|
|
9
|
+
On macOS and Linux, Lean Runtime first uses a published slim check toolchain when
|
|
10
|
+
one is available and otherwise installs the requested Lean version through its
|
|
10
11
|
private, checksum-verified Elan installation. It does not change the user's
|
|
11
12
|
default toolchain or shell profile. Windows currently requires an existing Elan
|
|
12
13
|
executable through `LEAN_RUNTIME_ELAN`.
|
|
13
14
|
|
|
15
|
+
## Start a Lake project
|
|
16
|
+
|
|
17
|
+
Create a standard Lake library with the newest cataloged Mathlib release and
|
|
18
|
+
shared exact dependencies:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
lean-runtime init MyProof --mathlib
|
|
22
|
+
cd MyProof
|
|
23
|
+
lean-runtime build .
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
By default, `init` writes an `AGENTS.md` explaining the project workflow and
|
|
27
|
+
shared-dependency safety rules to coding agents. Pass `--no-agents` to omit it.
|
|
28
|
+
An existing file is preserved.
|
|
29
|
+
|
|
30
|
+
Use `--mathlib 4.33.0` to select that release explicitly. Omit `--mathlib` for
|
|
31
|
+
a core-only library. The root project remains an ordinary mutable Lake project;
|
|
32
|
+
its dependency sources and build artifacts are reused by other projects with
|
|
33
|
+
the same exact graph.
|
|
34
|
+
|
|
35
|
+
For an existing project or a directory containing many projects, preview the
|
|
36
|
+
migration before applying it:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
lean-runtime attach .
|
|
40
|
+
lean-runtime attach ~/research --recursive
|
|
41
|
+
lean-runtime attach ~/research --recursive --execute
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The first two commands are read-only. Execution verifies the shared graph,
|
|
45
|
+
replaces only generated package copies, and rolls back the swap if ordinary
|
|
46
|
+
Lake cannot load the result. See [Local Lake projects](local-projects.md) for
|
|
47
|
+
detachment, storage estimates, and the complete safety model.
|
|
48
|
+
|
|
14
49
|
## Run a file
|
|
15
50
|
|
|
16
51
|
For a file inside a pinned Lake project:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Lean Runtime
|
|
2
2
|
|
|
3
3
|
Lean Runtime runs Lean proofs from Python or a single `.lean` file. It discovers
|
|
4
|
-
local Lake projects or compiles friendly exact dependencies into
|
|
4
|
+
local Lake projects or compiles friendly exact dependencies into an
|
|
5
5
|
exact reusable environment, then returns structured results and a record of what
|
|
6
6
|
was used.
|
|
7
7
|
|
|
@@ -28,9 +28,12 @@ It deliberately does not replace the official tools:
|
|
|
28
28
|
|
|
29
29
|
The front-facing API supports setup-once Python environments, one-shot helpers,
|
|
30
30
|
friendly exact package references, standalone TOML frontmatter, local-project
|
|
31
|
-
discovery, exact lock output, batch checking, and
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
discovery, shared Lake dependencies, exact lock output, batch checking, and
|
|
32
|
+
asyncio. New projects can begin with a shared catalog-pinned Mathlib graph;
|
|
33
|
+
existing project trees can preview and transactionally adopt the same layout.
|
|
34
|
+
The explicit runtime also exposes environment libraries, portable copies,
|
|
35
|
+
trusted publishers, verification, captures, policies, and storage lifecycle
|
|
36
|
+
operations.
|
|
34
37
|
|
|
35
38
|
The local backend executes **trusted inputs only**. Lean packages and Lake
|
|
36
39
|
configuration can run native programs and arbitrary build commands; the local
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Local Lake projects
|
|
2
|
+
|
|
3
|
+
Lean Runtime can discover and operate on an existing trusted Lake checkout
|
|
4
|
+
without converting it into an immutable managed environment:
|
|
5
|
+
|
|
6
|
+
```python
|
|
7
|
+
from lean_runtime import Runtime
|
|
8
|
+
|
|
9
|
+
project = Runtime().project("./my-project")
|
|
10
|
+
project.build()
|
|
11
|
+
result = project.check_file("./my-project/MyProject/Main.lean")
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`Runtime.project()` accepts either the project root or any contained path. It
|
|
15
|
+
walks upward and selects the nearest directory containing both `lean-toolchain`
|
|
16
|
+
and `lakefile.toml` or `lakefile.lean`.
|
|
17
|
+
|
|
18
|
+
`Runtime.check_file(path)` performs the same discovery automatically when no
|
|
19
|
+
managed environment, dependency list, or explicit toolchain is supplied:
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
result = Runtime().check_file("./my-project/MyProject/Main.lean")
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The CLI equivalent is:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
lean-runtime check-file ./my-project/MyProject/Main.lean
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The actual project-relative file is passed to `lake env lean`, so imports of
|
|
32
|
+
local modules retain normal Lake semantics. Checking a source string writes a
|
|
33
|
+
uniquely named disposable file under `.lake/lean-runtime/` and removes it after
|
|
34
|
+
execution:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
result = project.check("import MyProject\nexample : True := by trivial")
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Reusing dependencies across projects
|
|
41
|
+
|
|
42
|
+
Ordinary Lake workspaces put remote dependencies and their build artifacts in
|
|
43
|
+
each repository's `.lake/packages`. New projects can start in shared mode:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
lean-runtime init MyProof --mathlib
|
|
47
|
+
cd MyProof
|
|
48
|
+
lean-runtime build .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The generated files are a standard Lake project plus a small
|
|
52
|
+
`lean-runtime.toml`. Root build outputs stay local; exact dependencies are
|
|
53
|
+
shared. Select a cataloged release with `--mathlib 4.33.0`, or omit `--mathlib`
|
|
54
|
+
for a core-only library. `init` also creates an `AGENTS.md` describing the safe
|
|
55
|
+
build and dependency workflow unless `--no-agents` is passed; it never
|
|
56
|
+
overwrites an existing guide.
|
|
57
|
+
|
|
58
|
+
For one existing project, preview before changing anything:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
lean-runtime attach .
|
|
62
|
+
lean-runtime attach . --execute
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
For a directory containing many projects:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
lean-runtime attach ~/research --recursive
|
|
69
|
+
lean-runtime attach ~/research --recursive --execute
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The preview groups exact graphs, reports current and estimated shared storage,
|
|
73
|
+
and identifies missing local paths, dirty dependencies, and revision
|
|
74
|
+
mismatches. Execution continues through independent projects while reporting
|
|
75
|
+
per-project failures. It first prepares the exact shared workspace and probes it
|
|
76
|
+
through Lake. Only then does it atomically replace `.lake/packages` with package
|
|
77
|
+
links, probe the resulting project through ordinary Lake, and discard the old
|
|
78
|
+
generated copies. Any failure restores the original package directory.
|
|
79
|
+
|
|
80
|
+
The project itself remains portable. To return to independent package copies:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
lean-runtime detach .
|
|
84
|
+
lean-runtime detach . --execute
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Detachment copy-on-write clones the exact packages where the filesystem allows,
|
|
88
|
+
probes the standalone graph, and only then removes the attachment metadata. The
|
|
89
|
+
preview reports the maximum independent-copy size and available disk space;
|
|
90
|
+
execution refuses to rely on copy-on-write support when there is not enough
|
|
91
|
+
space for a full fallback copy.
|
|
92
|
+
|
|
93
|
+
The lower-level opt-in remains available without changing project layout:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
lean-runtime build . --shared
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Or from Python:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
Runtime().project(".").build(shared=True)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Lean Runtime reads the existing `lake-manifest.json` and passes Lake a generated
|
|
106
|
+
`--packages` override. Each remote package is keyed by its exact revision,
|
|
107
|
+
effective transitive dependency closure, Lean toolchain, and host platform;
|
|
108
|
+
local-path dependency contents are part of the surrounding workspace identity.
|
|
109
|
+
Dependency sources and their `.lake/build` artifacts live under the runtime
|
|
110
|
+
store, while the root project's own `.lake/build` remains in the checkout. This
|
|
111
|
+
lets two different root manifests share the same Mathlib package safely. Builds
|
|
112
|
+
that touch any of the same package keys are serialized because Lake may update
|
|
113
|
+
their artifacts.
|
|
114
|
+
|
|
115
|
+
The first shared build imports a clean, revision-matching local dependency copy
|
|
116
|
+
when one exists, using copy-on-write filesystem clones where supported. Missing
|
|
117
|
+
sources are fetched at the exact manifest commit. A plain shared build never
|
|
118
|
+
deletes the old `.lake/packages`; only an explicit `attach --execute` replaces
|
|
119
|
+
those generated copies after verification. `lean-runtime storage` reports
|
|
120
|
+
shared project package usage; automatic cleanup of those packages is not yet
|
|
121
|
+
implemented.
|
|
122
|
+
|
|
123
|
+
This mode requires a manifest and never runs `lake update`, so it cannot silently
|
|
124
|
+
change dependency revisions. It also reuses an existing local Git object database
|
|
125
|
+
when that database contains another requested revision, avoiding redundant Git
|
|
126
|
+
downloads. Local `path` dependencies remain at their declared locations and are
|
|
127
|
+
included in the workspace identity. Attached projects automatically use shared
|
|
128
|
+
mode when run through `lean-runtime build`; `--local` is an explicit escape
|
|
129
|
+
hatch for unattached checkouts. An attached project must be detached before a
|
|
130
|
+
local build, so `--local` cannot silently continue using shared links. After
|
|
131
|
+
changing the manifest or a local path dependency, rerun `lean-runtime attach .
|
|
132
|
+
--execute` to refresh the ordinary-Lake links.
|
|
133
|
+
|
|
134
|
+
This differs from `lake env lean File.lean`: that command only constructs the
|
|
135
|
+
current workspace's environment and checks one file; it neither builds missing
|
|
136
|
+
imports nor shares dependencies with another checkout. The shared build still
|
|
137
|
+
uses Lake's real build graph and project targets—it only changes where locked
|
|
138
|
+
dependencies come from. Attached links also let ordinary `lake build` and the
|
|
139
|
+
editor load the graph; prefer `lean-runtime build` when several projects may
|
|
140
|
+
build concurrently, because it serializes writes to shared artifacts.
|
|
141
|
+
|
|
142
|
+
## Mutable-project provenance
|
|
143
|
+
|
|
144
|
+
A local project is intentionally represented by `ProjectEnvironment`, not the
|
|
145
|
+
content-addressed `Environment` used for locked dependency graphs. Its results
|
|
146
|
+
therefore have `environment_id=None` and include project provenance containing:
|
|
147
|
+
|
|
148
|
+
- the canonical project root;
|
|
149
|
+
- a content digest excluding `.git` and `.lake`;
|
|
150
|
+
- Lake configuration and manifest digests;
|
|
151
|
+
- the Git revision and dirty state when Git metadata is available.
|
|
152
|
+
|
|
153
|
+
The workspace digest changes when local source or configuration changes, while
|
|
154
|
+
generated Lake artifacts do not affect it.
|
|
155
|
+
|
|
156
|
+
Lean Runtime does not run `lake update` or rewrite the manifest.
|
|
157
|
+
`project.build()` explicitly runs the pinned toolchain's `lake build`; checks
|
|
158
|
+
otherwise use the project exactly as it exists. Shared builds copy or fetch only
|
|
159
|
+
locked dependencies into the runtime store and leave the mutable root checkout
|
|
160
|
+
in place.
|
|
161
|
+
As with managed environments, Lake configuration and dependencies are trusted
|
|
162
|
+
code and the local backend is not a sandbox.
|
|
@@ -25,6 +25,13 @@ and testing; normal use should keep the probe enabled.
|
|
|
25
25
|
Saving, opening, and downloading are disk-backed and streamed. Peak memory does
|
|
26
26
|
not scale with the size of the environment.
|
|
27
27
|
|
|
28
|
+
`save-copy` deliberately preserves the legacy full environment, including
|
|
29
|
+
sources, for users who need a self-contained development handoff. `project
|
|
30
|
+
export` instead writes a source-free sparse check capsule containing only the
|
|
31
|
+
selected public module's transitive closure. `open-copy` detects and verifies
|
|
32
|
+
both formats. Native compilation and project development require the full
|
|
33
|
+
format; proof checking should prefer the capsule.
|
|
34
|
+
|
|
28
35
|
## Environment libraries
|
|
29
36
|
|
|
30
37
|
By default, Lean Runtime checks the public
|
|
@@ -64,8 +71,9 @@ lean-runtime \
|
|
|
64
71
|
download environment.lock.json
|
|
65
72
|
```
|
|
66
73
|
|
|
67
|
-
Downloaded
|
|
68
|
-
environment with identical
|
|
74
|
+
Downloaded pack frames are verified into a raw module CAS under the runtime
|
|
75
|
+
home. Opening another environment with identical module bytes reuses them even
|
|
76
|
+
when its lock or top-level package differs.
|
|
69
77
|
|
|
70
78
|
Old blobs can be included in garbage collection explicitly:
|
|
71
79
|
|
|
@@ -75,10 +83,11 @@ lean-runtime clean --include-downloads
|
|
|
75
83
|
lean-runtime clean --include-downloads --execute
|
|
76
84
|
```
|
|
77
85
|
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
Full OCI blobs referenced by ready legacy environments are retained. Sparse CAS
|
|
87
|
+
artifacts may be reclaimed because ready projections hold their own hardlink or
|
|
88
|
+
copy; active projection leases and per-artifact locks prevent races.
|
|
80
89
|
|
|
81
|
-
### Required publisher
|
|
90
|
+
### Required publisher verification
|
|
82
91
|
|
|
83
92
|
For high-trust workflows, require a Sigstore signature from one exact GitHub
|
|
84
93
|
Actions identity:
|
|
@@ -192,7 +201,7 @@ steps are not promised to produce byte-identical artifacts.
|
|
|
192
201
|
|
|
193
202
|
## Advanced storage details
|
|
194
203
|
|
|
195
|
-
The gzip file is a deterministic OCI image-layout archive. It contains a
|
|
204
|
+
The legacy gzip file is a deterministic OCI image-layout archive. It contains a
|
|
196
205
|
standard `oci-layout`, `index.json`, one image manifest, a Lean Runtime config
|
|
197
206
|
blob, and content-addressed layer blobs. The config contains the complete
|
|
198
207
|
`EnvironmentLock`, build profile, environment identity, and platform
|
|
@@ -213,6 +222,13 @@ Archives use sorted paths, zero timestamps and ownership, normalized tar
|
|
|
213
222
|
metadata, canonical JSON, and deterministic gzip headers. Exporting an unchanged
|
|
214
223
|
environment twice therefore produces identical bytes and digests.
|
|
215
224
|
|
|
225
|
+
A sparse capsule uses the same outer OCI layout but replaces source/package
|
|
226
|
+
tarballs with seekable zstd packs and a normalized module manifest. Pack frames
|
|
227
|
+
carry their own compressed digest and an inventory of raw artifact digests, so
|
|
228
|
+
a ranged response is verified without downloading the surrounding pack. The
|
|
229
|
+
matching check-only Lean toolchain is a separate OCI index and is never hidden
|
|
230
|
+
inside the environment lock.
|
|
231
|
+
|
|
216
232
|
## Compatibility and trust
|
|
217
233
|
|
|
218
234
|
`lock_id` identifies the platform-independent locked source graph.
|