lean-runtime 1.0.0__tar.gz → 2.0.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.
Files changed (107) hide show
  1. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/CHANGELOG.md +32 -0
  2. {lean_runtime-1.0.0/lean_runtime.egg-info → lean_runtime-2.0.0}/PKG-INFO +32 -9
  3. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/README.md +31 -8
  4. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/docs/architecture.md +11 -0
  5. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/docs/case-study-v1.md +1 -1
  6. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/docs/cli.md +27 -26
  7. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/docs/environments.md +2 -2
  8. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/docs/index.md +6 -5
  9. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/docs/local-projects.md +1 -1
  10. lean_runtime-1.0.0/docs/bundles.md → lean_runtime-2.0.0/docs/portable-copies.md +62 -58
  11. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/docs/python-api.md +13 -13
  12. lean_runtime-2.0.0/docs/ready-programs.md +53 -0
  13. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/docs/v1-precision.md +2 -2
  14. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/__init__.py +17 -14
  15. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/bundles.py +51 -20
  16. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/cli.py +174 -68
  17. lean_runtime-1.0.0/lean_runtime/diffing.py → lean_runtime-2.0.0/lean_runtime/comparison.py +10 -10
  18. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/errors.py +1 -1
  19. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/facade.py +7 -3
  20. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/matrix.py +5 -3
  21. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/models.py +2 -0
  22. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/oci.py +51 -47
  23. lean_runtime-2.0.0/lean_runtime/programs.py +740 -0
  24. lean_runtime-1.0.0/lean_runtime/signatures.py → lean_runtime-2.0.0/lean_runtime/publisher_verification.py +3 -3
  25. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/run_cli.py +5 -5
  26. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/runtime.py +200 -103
  27. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/schema_resources.py +2 -2
  28. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/store.py +10 -8
  29. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/wire.py +3 -3
  30. {lean_runtime-1.0.0 → lean_runtime-2.0.0/lean_runtime.egg-info}/PKG-INFO +32 -9
  31. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime.egg-info/SOURCES.txt +8 -5
  32. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/mkdocs.yml +4 -3
  33. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/pyproject.toml +1 -1
  34. lean_runtime-1.0.0/schemas/gc-v1.schema.json → lean_runtime-2.0.0/schemas/cleanup-v1.schema.json +7 -7
  35. lean_runtime-1.0.0/schemas/diff-v1.schema.json → lean_runtime-2.0.0/schemas/comparison-v1.schema.json +2 -2
  36. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/schemas/execution-v1.schema.json +4 -2
  37. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/scripts/smoke_wheel.py +4 -2
  38. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_bundles.py +55 -22
  39. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_cli.py +75 -14
  40. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_environment_integration.py +12 -12
  41. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_facade.py +1 -1
  42. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_prebuilt_policy.py +17 -14
  43. lean_runtime-2.0.0/tests/test_programs.py +92 -0
  44. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_projects.py +6 -6
  45. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_run_cli.py +2 -2
  46. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_runtime.py +2 -2
  47. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_schema_resources.py +2 -2
  48. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_schemas.py +7 -7
  49. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_signatures.py +7 -7
  50. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_store.py +8 -8
  51. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_v1_precision.py +28 -7
  52. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/LICENSE +0 -0
  53. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/MANIFEST.in +0 -0
  54. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/compatibility/README.md +0 -0
  55. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/compatibility/mathlib-4.32.2.json +0 -0
  56. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/compatibility/mathlib-4.32.2.toml +0 -0
  57. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/docs/captures.md +0 -0
  58. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/docs/development.md +0 -0
  59. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/docs/getting-started.md +0 -0
  60. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/docs/standalone-files.md +0 -0
  61. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/docs/trust-and-limitations.md +0 -0
  62. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/examples/mathlib.toml +0 -0
  63. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/__main__.py +0 -0
  64. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/backends.py +0 -0
  65. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/decisions.py +0 -0
  66. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/diagnostics.py +0 -0
  67. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/environments.py +0 -0
  68. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/events.py +0 -0
  69. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/frontmatter.py +0 -0
  70. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/health.py +0 -0
  71. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/lake.py +0 -0
  72. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/lockfiles.py +0 -0
  73. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/locking.py +0 -0
  74. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/policies.py +0 -0
  75. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/profiling.py +0 -0
  76. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/projects.py +0 -0
  77. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/py.typed +0 -0
  78. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/references.py +0 -0
  79. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/resolver.py +0 -0
  80. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/serialization.py +0 -0
  81. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/specs.py +0 -0
  82. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/timings.py +0 -0
  83. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/toolchains.py +0 -0
  84. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime/verification.py +0 -0
  85. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime.egg-info/dependency_links.txt +0 -0
  86. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime.egg-info/entry_points.txt +0 -0
  87. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime.egg-info/requires.txt +0 -0
  88. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/lean_runtime.egg-info/top_level.txt +0 -0
  89. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/schemas/inspect-v1.schema.json +0 -0
  90. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/schemas/matrix-v1.schema.json +0 -0
  91. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/schemas/profile-v1.schema.json +0 -0
  92. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/schemas/verify-v1.schema.json +0 -0
  93. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/scripts/run_compatibility.py +0 -0
  94. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/scripts/run_v1_case_study.py +0 -0
  95. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/setup.cfg +0 -0
  96. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/conftest.py +0 -0
  97. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_backend.py +0 -0
  98. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_diagnostics.py +0 -0
  99. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_events_health.py +0 -0
  100. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_frontmatter.py +0 -0
  101. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_interactive.py +0 -0
  102. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_lockfiles.py +0 -0
  103. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_multifile.py +0 -0
  104. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_references.py +0 -0
  105. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_specs.py +0 -0
  106. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_toolchains.py +0 -0
  107. {lean_runtime-1.0.0 → lean_runtime-2.0.0}/tests/test_verification_inventory.py +0 -0
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.0
4
+
5
+ Version 2 gives the public interface the language used by Lean users rather
6
+ than the language of its storage implementation. The environment format stays
7
+ compatible; command names, Python names, configuration, events, and public
8
+ metadata intentionally change without aliases.
9
+
10
+ ### Public terminology
11
+
12
+ - Environment libraries replace OCI caches in ordinary configuration and docs.
13
+ - Downloadable environments replace prebuilt artifacts.
14
+ - Portable copies replace OCI bundles.
15
+ - Publisher verification replaces signature-policy terminology.
16
+ - Cleanup and storage replace garbage-collection and blob terminology.
17
+ - Ready-to-run programs replace execution-capsule and container terminology.
18
+
19
+ ### Main migrations
20
+
21
+ - `Runtime(caches=..., prebuilt=...)` becomes
22
+ `Runtime(libraries=..., availability=...)`.
23
+ - `resolve`, `ensure`, and named `open` become `prepare`, `open_exact`, and
24
+ `environment` in the explicit Python API.
25
+ - `export_environment` and `import_environment` become `save_portable_copy`
26
+ and `open_portable_copy`.
27
+ - CLI workflows use `prepare`, `open`, `download`, `build-and-publish`,
28
+ `save-copy`, `open-copy`, `compare`, `storage`, and `clean`.
29
+ - Environment libraries accept friendly `ghcr.io/owner/name` locations; the
30
+ OCI transport remains an advanced implementation detail.
31
+ - Ready-to-run programs can be created, verified, copied, downloaded from a
32
+ program library, published for multiple kinds of computers, and interrupted
33
+ during interactive execution.
34
+
3
35
  ## 1.0.0
4
36
 
5
37
  Lean Runtime v1 establishes the concise `lean-run` and `lean.setup()` workflows while making
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lean-runtime
3
- Version: 1.0.0
3
+ Version: 2.0.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
@@ -38,8 +38,9 @@ Dynamic: license-file
38
38
  Run Lean proofs from Python or a single `.lean` file—without creating a throwaway
39
39
  Lake project or rebuilding the same dependencies on every machine.
40
40
 
41
- Lean Runtime discovers or resolves the environment, checks a global OCI cache,
42
- and returns structured Lean results with exact provenance.
41
+ Lean Runtime discovers the exact Lean environment a project needs and reuses a
42
+ downloadable copy when one is available. It returns structured Lean results
43
+ with a record of the toolchain and dependencies that were actually used.
43
44
 
44
45
  > **Status:** V1 beta. The local backend runs trusted Lean, Lake, and package code;
45
46
  > it is an orchestration boundary, not a security sandbox.
@@ -136,7 +137,7 @@ compare, and measure the same exact contexts:
136
137
 
137
138
  ```bash
138
139
  lean-runtime verify research-stack --offline
139
- lean-runtime diff previous.lock.json environment.lock.json
140
+ lean-runtime compare previous.lock.json environment.lock.json
140
141
  lean-runtime profile research-stack Main.lean --repeat 5
141
142
  lean-runtime matrix compatibility.toml Main.lean
142
143
  ```
@@ -150,13 +151,34 @@ Friendly references remain exact: use `mathlib@VERSION`,
150
151
  `github:owner/repository@REVISION` form. Bare floating package names are never
151
152
  accepted.
152
153
 
153
- ## Under the hood
154
+ ## Share environments
155
+
156
+ A **project** is your ordinary Lake repository. Its **environment** is the exact
157
+ Lean version, dependencies, and build configuration needed to use it. A
158
+ **downloadable environment** is a ready-to-use copy that collaborators and CI
159
+ can fetch instead of rebuilding Mathlib.
160
+
161
+ Environment libraries may be public or private. For example:
162
+
163
+ ```bash
164
+ lean-runtime --library ghcr.io/owner/lean-environments download environment.lock.json
165
+ lean-runtime build-and-publish environment.lock.json \
166
+ --publish-to ghcr.io/owner/lean-environments
167
+ ```
168
+
169
+ For an already-built executable, Lean Runtime can also create a verified
170
+ **ready-to-run program**. It opens without rebuilding the project, can be saved
171
+ as a portable copy, and can be shared through a public or private program
172
+ library. See [Ready-to-run programs](https://github.com/alerad/lean-runtime/blob/main/docs/ready-programs.md).
173
+
174
+ ## Technical details
154
175
 
155
176
  The simple API is backed by exact Git commits and trees, Lake-resolved locks,
156
177
  platform-aware content-addressed environments, atomic cross-process builds,
157
- transparent OCI cache reuse, replayable provenance, verification, and signed
158
- attestations. Advanced users can access all of it through `lean_runtime.Runtime`
159
- and the `lean-runtime` operations CLI.
178
+ downloadable environment reuse, replayable provenance, verification, and trusted
179
+ publishers. The libraries use OCI-compatible storage internally, but users do
180
+ not need Docker or container concepts. Advanced protocol details remain in the
181
+ architecture documentation.
160
182
 
161
183
  ## Documentation
162
184
 
@@ -165,7 +187,8 @@ and the `lean-runtime` operations CLI.
165
187
  - [`lean-run` and operations CLI](https://github.com/alerad/lean-runtime/blob/main/docs/cli.md)
166
188
  - [Managed environments](https://github.com/alerad/lean-runtime/blob/main/docs/environments.md)
167
189
  - [Local Lake projects](https://github.com/alerad/lean-runtime/blob/main/docs/local-projects.md)
168
- - [Environment bundles and OCI caches](https://github.com/alerad/lean-runtime/blob/main/docs/bundles.md)
190
+ - [Portable copies and environment libraries](https://github.com/alerad/lean-runtime/blob/main/docs/portable-copies.md)
191
+ - [Ready-to-run programs](https://github.com/alerad/lean-runtime/blob/main/docs/ready-programs.md)
169
192
  - [Architecture](https://github.com/alerad/lean-runtime/blob/main/docs/architecture.md)
170
193
  - [Trust and limitations](https://github.com/alerad/lean-runtime/blob/main/docs/trust-and-limitations.md)
171
194
  - [V1 release case study](https://github.com/alerad/lean-runtime/blob/main/docs/case-study-v1.md)
@@ -3,8 +3,9 @@
3
3
  Run Lean proofs from Python or a single `.lean` file—without creating a throwaway
4
4
  Lake project or rebuilding the same dependencies on every machine.
5
5
 
6
- Lean Runtime discovers or resolves the environment, checks a global OCI cache,
7
- and returns structured Lean results with exact provenance.
6
+ Lean Runtime discovers the exact Lean environment a project needs and reuses a
7
+ downloadable copy when one is available. It returns structured Lean results
8
+ with a record of the toolchain and dependencies that were actually used.
8
9
 
9
10
  > **Status:** V1 beta. The local backend runs trusted Lean, Lake, and package code;
10
11
  > it is an orchestration boundary, not a security sandbox.
@@ -101,7 +102,7 @@ compare, and measure the same exact contexts:
101
102
 
102
103
  ```bash
103
104
  lean-runtime verify research-stack --offline
104
- lean-runtime diff previous.lock.json environment.lock.json
105
+ lean-runtime compare previous.lock.json environment.lock.json
105
106
  lean-runtime profile research-stack Main.lean --repeat 5
106
107
  lean-runtime matrix compatibility.toml Main.lean
107
108
  ```
@@ -115,13 +116,34 @@ Friendly references remain exact: use `mathlib@VERSION`,
115
116
  `github:owner/repository@REVISION` form. Bare floating package names are never
116
117
  accepted.
117
118
 
118
- ## Under the hood
119
+ ## Share environments
120
+
121
+ A **project** is your ordinary Lake repository. Its **environment** is the exact
122
+ Lean version, dependencies, and build configuration needed to use it. A
123
+ **downloadable environment** is a ready-to-use copy that collaborators and CI
124
+ can fetch instead of rebuilding Mathlib.
125
+
126
+ Environment libraries may be public or private. For example:
127
+
128
+ ```bash
129
+ lean-runtime --library ghcr.io/owner/lean-environments download environment.lock.json
130
+ lean-runtime build-and-publish environment.lock.json \
131
+ --publish-to ghcr.io/owner/lean-environments
132
+ ```
133
+
134
+ For an already-built executable, Lean Runtime can also create a verified
135
+ **ready-to-run program**. It opens without rebuilding the project, can be saved
136
+ as a portable copy, and can be shared through a public or private program
137
+ library. See [Ready-to-run programs](https://github.com/alerad/lean-runtime/blob/main/docs/ready-programs.md).
138
+
139
+ ## Technical details
119
140
 
120
141
  The simple API is backed by exact Git commits and trees, Lake-resolved locks,
121
142
  platform-aware content-addressed environments, atomic cross-process builds,
122
- transparent OCI cache reuse, replayable provenance, verification, and signed
123
- attestations. Advanced users can access all of it through `lean_runtime.Runtime`
124
- and the `lean-runtime` operations CLI.
143
+ downloadable environment reuse, replayable provenance, verification, and trusted
144
+ publishers. The libraries use OCI-compatible storage internally, but users do
145
+ not need Docker or container concepts. Advanced protocol details remain in the
146
+ architecture documentation.
125
147
 
126
148
  ## Documentation
127
149
 
@@ -130,7 +152,8 @@ and the `lean-runtime` operations CLI.
130
152
  - [`lean-run` and operations CLI](https://github.com/alerad/lean-runtime/blob/main/docs/cli.md)
131
153
  - [Managed environments](https://github.com/alerad/lean-runtime/blob/main/docs/environments.md)
132
154
  - [Local Lake projects](https://github.com/alerad/lean-runtime/blob/main/docs/local-projects.md)
133
- - [Environment bundles and OCI caches](https://github.com/alerad/lean-runtime/blob/main/docs/bundles.md)
155
+ - [Portable copies and environment libraries](https://github.com/alerad/lean-runtime/blob/main/docs/portable-copies.md)
156
+ - [Ready-to-run programs](https://github.com/alerad/lean-runtime/blob/main/docs/ready-programs.md)
134
157
  - [Architecture](https://github.com/alerad/lean-runtime/blob/main/docs/architecture.md)
135
158
  - [Trust and limitations](https://github.com/alerad/lean-runtime/blob/main/docs/trust-and-limitations.md)
136
159
  - [V1 release case study](https://github.com/alerad/lean-runtime/blob/main/docs/case-study-v1.md)
@@ -1,5 +1,16 @@
1
1
  # Architecture
2
2
 
3
+ ## Ready-to-run programs
4
+
5
+ A ready-to-run program is the small result you can open immediately, without
6
+ rebuilding its Lean project first. Lean Runtime verifies its files every time it
7
+ is opened and records the exact source revision and, when known, the environment
8
+ that produced it. Use one for fast service execution. Open the full environment
9
+ when you need kernel replay, custom compilation, or an independent rebuild.
10
+
11
+ Program libraries and portable program copies use OCI-compatible storage under
12
+ the hood. That transport detail does not appear in the ordinary Python API or CLI.
13
+
3
14
  ## Dominant abstraction
4
15
 
5
16
  Lean Runtime is an environment compiler:
@@ -23,7 +23,7 @@ The resulting JSON records:
23
23
  - offline verification and captured-execution replay.
24
24
 
25
25
  The harness deliberately starts from an already prepared environment. Measure cold source
26
- preparation separately and state whether local, Lake, and OCI caches were empty. Do not combine
26
+ preparation separately and state whether local, Lake, and OCI libraries were empty. Do not combine
27
27
  cold source builds and warm execution into one headline number.
28
28
 
29
29
  ## Clean-wheel acceptance
@@ -47,31 +47,31 @@ lean-runtime check Main.lean \
47
47
  ## Environment workflow
48
48
 
49
49
  ```bash
50
- lean-runtime resolve environment.toml --output environment.lock.json
51
- lean-runtime ensure environment.lock.json --name research-stack
52
- lean-runtime --cache oci://ghcr.io/owner/cache pull environment.lock.json
53
- lean-runtime export research-stack --output research-stack.oci.tar.gz
54
- lean-runtime --home /tmp/fresh import research-stack.oci.tar.gz --name research-stack
55
- lean-runtime build-and-push environment.lock.json --push-to oci://ghcr.io/owner/cache
50
+ lean-runtime prepare environment.toml --output environment.lock.json
51
+ lean-runtime open environment.lock.json --name research-stack
52
+ lean-runtime --library ghcr.io/owner/lean-environments download environment.lock.json
53
+ lean-runtime save-copy research-stack --output research-stack.lean-environment
54
+ lean-runtime --home /tmp/fresh open-copy research-stack.lean-environment --name research-stack
55
+ lean-runtime build-and-publish environment.lock.json --publish-to ghcr.io/owner/lean-environments
56
56
  lean-runtime check research-stack Main.lean --json
57
57
  lean-runtime inspect research-stack --packages
58
- lean-runtime env-list
59
- lean-runtime cache-status
58
+ lean-runtime environments
59
+ lean-runtime storage
60
60
  lean-runtime doctor
61
61
  lean-runtime verify research-stack --offline
62
- lean-runtime diff old.lock.json new.lock.json
62
+ lean-runtime compare old.lock.json new.lock.json
63
63
  lean-runtime profile research-stack Main.lean --repeat 5
64
64
  lean-runtime matrix matrix.toml Main.lean
65
- lean-runtime gc
66
- lean-runtime gc --execute
65
+ lean-runtime clean
66
+ lean-runtime clean --execute
67
67
  ```
68
68
 
69
- `gc` is a dry run unless `--execute` is supplied.
69
+ `clean` is a dry run unless `--execute` is supplied.
70
70
 
71
- `export` produces a deterministic OCI image-layout archive. `import` verifies
72
- the digest and identity chain, package Git trees, platform compatibility, and a
73
- Lean probe before atomically publishing the environment. See
74
- [Environment bundles](bundles.md) for the format and trust boundary.
71
+ `save-copy` creates a portable environment file. `open-copy` verifies its exact
72
+ identity, package Git trees, computer compatibility, and Lean probe before
73
+ making the environment available. See [Portable copies and environment
74
+ libraries](portable-copies.md) for its trust boundary.
75
75
 
76
76
  ## Replay
77
77
 
@@ -86,14 +86,14 @@ environment can replay offline.
86
86
  ## Existing projects and core Lean
87
87
 
88
88
  ```bash
89
- lean-runtime raw-check Main.lean --toolchain 4.32.2
90
- lean-runtime raw-check ./existing-project/MyProject/Main.lean
91
- lean-runtime project-build ./existing-project MyLibrary
89
+ lean-runtime check-file Main.lean --toolchain 4.32.2
90
+ lean-runtime check-file ./existing-project/MyProject/Main.lean
91
+ lean-runtime build ./existing-project MyLibrary
92
92
  lean-runtime install 4.32.2
93
93
  ```
94
94
 
95
95
  Without `--with`, the environment-aware `check` command requires an environment
96
- identifier. `raw-check` remains the explicitly unmanaged route. When no
96
+ identifier. `check-file` is the direct local-project route. When no
97
97
  `--project` or `--toolchain` is supplied, it discovers the nearest directory
98
98
  containing a Lake configuration and `lean-toolchain`, then passes the actual
99
99
  project-relative file to `lake env lean`.
@@ -112,10 +112,11 @@ execution output uses the versioned `lean-runtime.execution/v1` envelope; the ot
112
112
  schemas and advanced command examples are documented in
113
113
  [Verify, understand, compare, and measure](v1-precision.md).
114
114
 
115
- Global `--cache` is repeatable and `--prebuilt auto|require|never` controls
116
- transparent cache acquisition. `LEAN_RUNTIME_CACHES` accepts a comma-separated
117
- equivalent and `LEAN_RUNTIME_PREBUILT` sets the default policy.
115
+ Global `--library` is repeatable and `--availability auto|required|local`
116
+ controls whether ready-to-use environments are downloaded or built locally.
117
+ `LEAN_RUNTIME_LIBRARIES` accepts a comma-separated equivalent and
118
+ `LEAN_RUNTIME_AVAILABILITY` sets the default policy.
118
119
 
119
- Use global `--signatures require --trusted-identity ID --trusted-issuer ISSUER`
120
- to require a Cosign-verified publisher. `build-and-push --sign` signs the
121
- published lock-index digest using Cosign's configured keyless or keyed context.
120
+ Use global `--publisher_verification required --trusted-publisher ID --trusted-issuer ISSUER`
121
+ to require a verified publisher. `build-and-publish --sign` records the trusted
122
+ publisher using the configured Cosign identity.
@@ -88,6 +88,6 @@ serializing concurrent checks. Locks and source snapshots remain retained in
88
88
  the current store schema.
89
89
 
90
90
  ```python
91
- report = runtime.gc(dry_run=True)
92
- report = runtime.gc(dry_run=False, minimum_age_seconds=30 * 24 * 60 * 60)
91
+ report = runtime.clean(dry_run=True)
92
+ report = runtime.clean(dry_run=False, minimum_age_seconds=30 * 24 * 60 * 60)
93
93
  ```
@@ -2,7 +2,8 @@
2
2
 
3
3
  Lean Runtime runs Lean proofs from Python or a single `.lean` file. It discovers
4
4
  local Lake projects or compiles friendly exact dependencies into a
5
- content-addressed environment, then returns structured results and provenance.
5
+ exact reusable environment, then returns structured results and a record of what
6
+ was used.
6
7
 
7
8
  ```text
8
9
  lean-run FILE / lean.setup(CONTEXT)
@@ -20,16 +21,16 @@ It deliberately does not replace the official tools:
20
21
 
21
22
  - **Elan** installs and selects Lean toolchains.
22
23
  - **Lake** resolves packages and builds workspaces.
23
- - **Lean Runtime** owns acquisition, immutable identities, caching, execution
24
- policy, Python ergonomics, and provenance.
24
+ - **Lean Runtime** prepares exact environments, reuses downloaded and built
25
+ files, runs Lean, and records what was used.
25
26
 
26
27
  ## Current scope
27
28
 
28
29
  The front-facing API supports setup-once Python environments, one-shot helpers,
29
30
  friendly exact package references, standalone TOML frontmatter, local-project
30
31
  discovery, exact lock output, batch checking, and asyncio. The explicit runtime
31
- also exposes OCI caches, bundles, verification, signatures, captures, policies, and
32
- store lifecycle operations.
32
+ also exposes environment libraries, portable copies, trusted publishers,
33
+ verification, captures, policies, and storage lifecycle operations.
33
34
 
34
35
  The local backend executes **trusted inputs only**. Lean packages and Lake
35
36
  configuration can run native programs and arbitrary build commands; the local
@@ -25,7 +25,7 @@ result = Runtime().check_file("./my-project/MyProject/Main.lean")
25
25
  The CLI equivalent is:
26
26
 
27
27
  ```bash
28
- lean-runtime raw-check ./my-project/MyProject/Main.lean
28
+ lean-runtime check-file ./my-project/MyProject/Main.lean
29
29
  ```
30
30
 
31
31
  The actual project-relative file is passed to `lake env lean`, so imports of
@@ -1,106 +1,104 @@
1
- # Environment bundles
1
+ # Portable copies and environment libraries
2
2
 
3
3
  Lean Runtime can move an already built environment between compatible machines
4
4
  without rebuilding its Lake packages:
5
5
 
6
6
  ```bash
7
- lean-runtime export research-stack --output research-stack.oci.tar.gz
8
- lean-runtime --home /tmp/fresh import research-stack.oci.tar.gz --name research-stack
7
+ lean-runtime save-copy research-stack --output research-stack.lean-environment
8
+ lean-runtime --home /tmp/fresh open-copy research-stack.lean-environment --name research-stack
9
9
  ```
10
10
 
11
11
  The equivalent Python API is:
12
12
 
13
13
  ```python
14
- info = runtime.export_environment("research-stack", "research-stack.oci.tar.gz")
15
- environment = another_runtime.import_environment("research-stack.oci.tar.gz", name="research-stack")
14
+ info = runtime.save_portable_copy("research-stack", "research-stack.lean-environment")
15
+ environment = another_runtime.open_portable_copy(
16
+ "research-stack.lean-environment", name="research-stack"
17
+ )
16
18
  ```
17
19
 
18
- Import verifies the OCI manifest and every blob digest, recomputes the lock and
19
- environment identities, requires an exact platform compatibility match, checks
20
- each package's Git commit and tree, and runs a Lean probe. Publication uses a
21
- staging directory and atomic rename, so a failed import is never visible as a
22
- ready environment. `--no-probe` exists for inspection and testing workflows;
23
- normal imports should keep the probe enabled.
20
+ Opening a copy verifies its exact environment identity, computer compatibility,
21
+ package revisions, and a real Lean import before making it available. A failed
22
+ open never appears as a ready environment. `--no-probe` exists for inspection
23
+ and testing; normal use should keep the probe enabled.
24
24
 
25
- Layer construction, archive writing, import, and registry downloads are
26
- disk-backed and streamed. Peak memory does not scale with package-layer size.
25
+ Saving, opening, and downloading are disk-backed and streamed. Peak memory does
26
+ not scale with the size of the environment.
27
27
 
28
- ## OCI global caches
28
+ ## Environment libraries
29
29
 
30
30
  By default, Lean Runtime checks the public
31
- `oci://ghcr.io/alerad/lean-runtime-cache` mirror. A miss or availability failure
31
+ `ghcr.io/alerad/lean-runtime-cache` library. A missing or unavailable copy
32
32
  falls back to the existing source build, so environment specifications do not
33
- change. Set `LEAN_RUNTIME_CACHES=` or construct `Runtime(caches=[])` to disable
34
- all remote cache lookups.
33
+ change. Set `LEAN_RUNTIME_LIBRARIES=` or construct `Runtime(libraries=[])` to disable
34
+ all library lookups.
35
35
 
36
- Configure one or more cache repositories without changing the environment
36
+ Configure one or more libraries without changing the environment
37
37
  specification or lock:
38
38
 
39
39
  ```python
40
40
  runtime = Runtime(
41
- caches=["oci://ghcr.io/alerad/leancert-runtime"],
42
- prebuilt="auto",
41
+ libraries=["ghcr.io/alerad/leancert-runtime"],
42
+ availability="auto",
43
43
  )
44
- environment = runtime.ensure(lock)
44
+ environment = runtime.open_exact(lock)
45
45
  ```
46
46
 
47
47
  The equivalent environment variables are:
48
48
 
49
49
  ```bash
50
- export LEAN_RUNTIME_CACHES=oci://ghcr.io/alerad/leancert-runtime
51
- export LEAN_RUNTIME_PREBUILT=auto
50
+ export LEAN_RUNTIME_LIBRARIES=ghcr.io/alerad/leancert-runtime
51
+ export LEAN_RUNTIME_AVAILABILITY=auto
52
52
  ```
53
53
 
54
- `auto` tries caches in order and builds from source when an artifact is absent,
55
- incompatible, or temporarily unavailable. `require` makes an ordinary cache
56
- miss an error. `never` disables remote lookup. Digest, lock, archive-safety, and
57
- probe failures are security failures and never silently fall back to source.
54
+ `auto` tries libraries in order and builds locally when a copy is absent,
55
+ incompatible, or temporarily unavailable. `required` makes a missing copy an
56
+ error. `local` disables library lookup. Verification failures never silently
57
+ fall back to a local build.
58
58
 
59
59
  Explicit prefetch uses the same verified path:
60
60
 
61
61
  ```bash
62
62
  lean-runtime \
63
- --cache oci://ghcr.io/alerad/leancert-runtime \
64
- pull environment.lock.json
63
+ --library ghcr.io/alerad/leancert-runtime \
64
+ download environment.lock.json
65
65
  ```
66
66
 
67
- Registry blobs are retained content-addressed under the runtime home. Pulling a
68
- second environment with an identical package layer reuses it without another
69
- download.
67
+ Downloaded files are retained under the runtime home. Opening another
68
+ environment with identical dependencies reuses them without another download.
70
69
 
71
70
  Old blobs can be included in garbage collection explicitly:
72
71
 
73
72
  ```bash
74
73
  # Preview, then apply after reviewing the candidates.
75
- lean-runtime gc --include-blobs
76
- lean-runtime gc --include-blobs --execute
74
+ lean-runtime clean --include-downloads
75
+ lean-runtime clean --include-downloads --execute
77
76
  ```
78
77
 
79
- Blobs referenced by an imported environment or leased by an active pull are
80
- retained. Collection rechecks both conditions while holding the same per-blob
81
- lock used by downloads.
78
+ Files used by a ready environment or an active download are retained. Cleanup
79
+ rechecks both conditions before removing anything.
82
80
 
83
- ### Required publisher signatures
81
+ ### Required publisher publisher_verification
84
82
 
85
83
  For high-trust workflows, require a Sigstore signature from one exact GitHub
86
84
  Actions identity:
87
85
 
88
86
  ```python
89
87
  runtime = Runtime(
90
- caches=["oci://ghcr.io/alerad/leancert-runtime"],
91
- signatures="require",
92
- trusted_identity=(
88
+ libraries=["ghcr.io/alerad/leancert-runtime"],
89
+ publisher_verification="required",
90
+ trusted_publisher=(
93
91
  "https://github.com/alerad/leancert/.github/workflows/cache.yml@refs/heads/main"
94
92
  ),
95
93
  trusted_issuer="https://token.actions.githubusercontent.com",
96
94
  )
97
95
  ```
98
96
 
99
- CLI equivalents are `--signatures require`, `--trusted-identity`, and
97
+ CLI equivalents are `--publisher_verification required`, `--trusted-publisher`, and
100
98
  `--trusted-issuer`. Verification uses an installed Cosign 2.6.2 or 3.0.4+ and
101
99
  binds the canonical lock-index digest, certificate identity, issuer, and
102
100
  transparency-log claims. Older versions are rejected because of the patched
103
- [Cosign verification advisory](https://github.com/sigstore/cosign/security/advisories/GHSA-whqx-f9j3-ch6m).
101
+ [Cosign verification advisory](https://github.com/sigstore/verification_tool/security/advisories/GHSA-whqx-f9j3-ch6m).
104
102
 
105
103
  Signature failure is an integrity failure and never triggers source fallback.
106
104
 
@@ -112,8 +110,8 @@ Publish the current platform after ensuring the lock:
112
110
  export LEAN_RUNTIME_REGISTRY_USERNAME=alerad
113
111
  export LEAN_RUNTIME_REGISTRY_PASSWORD="$GHCR_TOKEN"
114
112
 
115
- lean-runtime build-and-push environment.lock.json \
116
- --push-to oci://ghcr.io/alerad/leancert-runtime \
113
+ lean-runtime build-and-publish environment.lock.json \
114
+ --publish-to ghcr.io/alerad/leancert-runtime \
117
115
  --tag v4.32.2.4 \
118
116
  --sign --attest
119
117
  ```
@@ -135,21 +133,21 @@ permissions:
135
133
 
136
134
  steps:
137
135
  - uses: actions/checkout@v4
138
- - uses: ./.github/actions/cache
136
+ - uses: ./.github/actions/publish-environment
139
137
  with:
140
138
  lock: environment.lock.json
141
- repository: oci://ghcr.io/${{ github.repository_owner }}/leancert-runtime
139
+ library: ghcr.io/${{ github.repository_owner }}/leancert-runtime
142
140
  tag: ${{ github.ref_name }}
143
- registry-username: ${{ github.actor }}
144
- registry-password: ${{ secrets.GITHUB_TOKEN }}
141
+ username: ${{ github.actor }}
142
+ password: ${{ secrets.GITHUB_TOKEN }}
145
143
  ```
146
144
 
147
145
  For a build matrix, have each platform publish without changing the canonical
148
146
  index and retain its JSON result:
149
147
 
150
148
  ```bash
151
- lean-runtime build-and-push environment.lock.json \
152
- --push-to oci://ghcr.io/alerad/leancert-runtime \
149
+ lean-runtime build-and-publish environment.lock.json \
150
+ --publish-to ghcr.io/alerad/leancert-runtime \
153
151
  --platform-only > platform-result.json
154
152
  ```
155
153
 
@@ -157,8 +155,8 @@ After collecting the result files, one final job publishes the deterministic
157
155
  multi-platform index and human aliases:
158
156
 
159
157
  ```bash
160
- lean-runtime publish-index "$LOCK_ID" results/*.json \
161
- --repository oci://ghcr.io/alerad/leancert-runtime \
158
+ lean-runtime finalize-publication "$LOCK_ID" results/*.json \
159
+ --library ghcr.io/alerad/leancert-runtime \
162
160
  --tag "$GITHUB_REF_NAME"
163
161
  ```
164
162
 
@@ -192,7 +190,7 @@ separate byte-reproducibility measurement: a mismatch is reported but is not
192
190
  treated as failed source/proof verification, because native toolchains and package build
193
191
  steps are not promised to produce byte-identical artifacts.
194
192
 
195
- ## Format version 1
193
+ ## Advanced storage details
196
194
 
197
195
  The gzip file is a deterministic OCI image-layout archive. It contains a
198
196
  standard `oci-layout`, `index.json`, one image manifest, a Lean Runtime config
@@ -205,6 +203,12 @@ package. Package layers include both source and `.lake/build`, so identical
205
203
  serialized package trees are reused by the registry transport. The Lean
206
204
  toolchain is not bundled; Elan supplies the exact toolchain named by the lock.
207
205
 
206
+ Package verification binds every tracked file to the locked Git commit and
207
+ tree and rejects non-ignored untracked source. Git-ignored files generated by
208
+ package build tooling are treated as derived artifacts: their bytes remain
209
+ covered by the OCI layer digest and publisher trust policy, but they do not
210
+ change the locked source identity.
211
+
208
212
  Archives use sorted paths, zero timestamps and ownership, normalized tar
209
213
  metadata, canonical JSON, and deterministic gzip headers. Exporting an unchanged
210
214
  environment twice therefore produces identical bytes and digests.
@@ -214,9 +218,9 @@ environment twice therefore produces identical bytes and digests.
214
218
  `lock_id` identifies the platform-independent locked source graph.
215
219
  `environment_id` additionally includes the release build profile and the
216
220
  versioned platform compatibility record. Informational host details remain in
217
- metadata but do not invalidate compatible caches across OS patch releases.
221
+ metadata but do not invalidate compatible libraries across OS patch releases.
218
222
 
219
- A bundle is trusted executable build output. Digest, lock, Git-tree, and probe
223
+ A portable copy is trusted executable build output. Digest, lock, Git-tree, and probe
220
224
  verification detect corruption and identity substitution, but do not prove that
221
- the builder compiled the sources faithfully. Registry credentials authenticate
222
- access but are not a builder attestation; only use cache publishers you trust.
225
+ the builder compiled the sources faithfully. Library credentials authenticate
226
+ access but are not a builder attestation; only use environment publishers you trust.