lean-runtime 4.0.0__tar.gz → 4.1.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 (209) hide show
  1. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/CHANGELOG.md +11 -0
  2. {lean_runtime-4.0.0/lean_runtime.egg-info → lean_runtime-4.1.0}/PKG-INFO +30 -8
  3. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/README.md +29 -7
  4. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/catalog/environments.toml +0 -9
  5. lean_runtime-4.1.0/docs/concepts/context-selection.md +54 -0
  6. lean_runtime-4.1.0/docs/index.md +118 -0
  7. lean_runtime-4.1.0/docs/reference/commands.md +67 -0
  8. lean_runtime-4.1.0/docs/reference/python-api.md +200 -0
  9. lean_runtime-4.1.0/docs/trust.md +42 -0
  10. lean_runtime-4.1.0/docs/tutorial.md +129 -0
  11. lean_runtime-4.1.0/docs/workflows/check-files.md +95 -0
  12. lean_runtime-4.1.0/docs/workflows/lake-projects.md +91 -0
  13. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/__init__.py +5 -0
  14. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/capsules.py +4 -2
  15. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/cli.py +50 -8
  16. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/console.py +16 -0
  17. lean_runtime-4.1.0/lean_runtime/context_resolution.py +59 -0
  18. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/__init__.py +3 -2
  19. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/analyzer.py +4 -15
  20. lean_runtime-4.1.0/lean_runtime/discovery/api.py +213 -0
  21. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/candidate.py +8 -11
  22. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/catalog.py +67 -8
  23. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/catalog_build.py +0 -1
  24. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/catalog_manifest.py +1 -7
  25. lean_runtime-4.1.0/lean_runtime/discovery/data/catalog.json +1 -0
  26. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/engine.py +131 -31
  27. lean_runtime-4.1.0/lean_runtime/discovery/history.py +176 -0
  28. lean_runtime-4.1.0/lean_runtime/discovery/memo.py +35 -0
  29. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/module_inventory.py +45 -2
  30. lean_runtime-4.1.0/lean_runtime/discovery/planner.py +243 -0
  31. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/policy.py +14 -14
  32. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/probe.py +20 -9
  33. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/result.py +29 -1
  34. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/schemas/catalog-v1.schema.json +1 -1
  35. lean_runtime-4.1.0/lean_runtime/discovery/schemas/plan-v1.schema.json +25 -0
  36. lean_runtime-4.1.0/lean_runtime/discovery/schemas/result-v1.schema.json +30 -0
  37. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/environments.py +19 -5
  38. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/errors.py +39 -3
  39. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/header_cache.py +5 -4
  40. lean_runtime-4.1.0/lean_runtime/import_syntax.py +21 -0
  41. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/lake_cache.py +25 -0
  42. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/oci.py +7 -7
  43. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/project_execution.py +93 -6
  44. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/projects.py +4 -2
  45. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/run_cli.py +167 -87
  46. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/runtime.py +225 -22
  47. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/shared_projects.py +403 -34
  48. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/store.py +14 -17
  49. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/toolchain_oci.py +5 -1
  50. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/toolchain_slim.py +1 -0
  51. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/toolchains.py +14 -0
  52. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/verification.py +14 -5
  53. {lean_runtime-4.0.0 → lean_runtime-4.1.0/lean_runtime.egg-info}/PKG-INFO +30 -8
  54. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime.egg-info/SOURCES.txt +13 -16
  55. lean_runtime-4.1.0/mkdocs.yml +70 -0
  56. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/pyproject.toml +1 -1
  57. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/scripts/announcement_gate.py +13 -5
  58. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/scripts/registry_preflight.py +27 -12
  59. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/discovery/test_analyzer.py +7 -0
  60. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/discovery/test_catalog.py +16 -0
  61. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/discovery/test_catalog_build.py +17 -2
  62. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/discovery/test_engine.py +142 -26
  63. lean_runtime-4.1.0/tests/discovery/test_memo.py +34 -0
  64. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/discovery/test_planner.py +83 -19
  65. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/discovery/test_policy.py +6 -1
  66. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_cli.py +15 -0
  67. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_console.py +32 -0
  68. lean_runtime-4.1.0/tests/test_context_resolution.py +51 -0
  69. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_environment_integration.py +7 -0
  70. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_lake_cache.py +20 -0
  71. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_project_publish.py +12 -0
  72. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_projects.py +468 -3
  73. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_run_cli.py +53 -6
  74. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_toolchains.py +3 -0
  75. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_verification_probe.py +27 -2
  76. lean_runtime-4.0.0/docs/architecture.md +0 -203
  77. lean_runtime-4.0.0/docs/captures.md +0 -32
  78. lean_runtime-4.0.0/docs/case-study-v1.md +0 -47
  79. lean_runtime-4.0.0/docs/cli.md +0 -111
  80. lean_runtime-4.0.0/docs/development.md +0 -103
  81. lean_runtime-4.0.0/docs/environments.md +0 -32
  82. lean_runtime-4.0.0/docs/getting-started.md +0 -42
  83. lean_runtime-4.0.0/docs/index.md +0 -47
  84. lean_runtime-4.0.0/docs/lake-artifact-cache-design.md +0 -154
  85. lean_runtime-4.0.0/docs/local-projects.md +0 -70
  86. lean_runtime-4.0.0/docs/portable-copies.md +0 -315
  87. lean_runtime-4.0.0/docs/project-publishing.md +0 -32
  88. lean_runtime-4.0.0/docs/python-api.md +0 -311
  89. lean_runtime-4.0.0/docs/ready-programs.md +0 -60
  90. lean_runtime-4.0.0/docs/standalone-files.md +0 -33
  91. lean_runtime-4.0.0/docs/trust-and-limitations.md +0 -71
  92. lean_runtime-4.0.0/docs/v1-precision.md +0 -141
  93. lean_runtime-4.0.0/lean_runtime/discovery/api.py +0 -121
  94. lean_runtime-4.0.0/lean_runtime/discovery/data/catalog.json +0 -1
  95. lean_runtime-4.0.0/lean_runtime/discovery/planner.py +0 -185
  96. lean_runtime-4.0.0/lean_runtime/discovery/schemas/plan-v1.schema.json +0 -15
  97. lean_runtime-4.0.0/lean_runtime/discovery/schemas/result-v1.schema.json +0 -15
  98. lean_runtime-4.0.0/mkdocs.yml +0 -61
  99. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/LICENSE +0 -0
  100. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/MANIFEST.in +0 -0
  101. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/catalog/locks/core-v4.32.2.lock.json +0 -0
  102. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/catalog/locks/leancert-v4.30.0.5.lock.json +0 -0
  103. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/catalog/locks/leancert-v4.31.0.lock.json +0 -0
  104. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/catalog/locks/leancert-v4.32.2.4.lock.json +0 -0
  105. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/catalog/locks/leancert-v4.33.0.lock.json +0 -0
  106. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/catalog/locks/mathlib-v4.30.0.lock.json +0 -0
  107. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/catalog/locks/mathlib-v4.31.0.lock.json +0 -0
  108. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/catalog/locks/mathlib-v4.32.2.lock.json +0 -0
  109. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/catalog/locks/mathlib-v4.33.0.lock.json +0 -0
  110. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/compatibility/README.md +0 -0
  111. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/compatibility/lake-artifact-cache-4.33.0.json +0 -0
  112. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/compatibility/mathlib-4.32.2.json +0 -0
  113. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/compatibility/mathlib-4.32.2.toml +0 -0
  114. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/compatibility/mathlib-4.33.0.json +0 -0
  115. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/compatibility/mathlib-4.33.0.toml +0 -0
  116. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/examples/mathlib.toml +0 -0
  117. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/__main__.py +0 -0
  118. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/_git.py +0 -0
  119. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/_paths.py +0 -0
  120. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/backends.py +0 -0
  121. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/bundles.py +0 -0
  122. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/comparison.py +0 -0
  123. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/decisions.py +0 -0
  124. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/diagnostics.py +0 -0
  125. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/catalog_cli.py +0 -0
  126. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/defaults.py +0 -0
  127. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/errors.py +0 -0
  128. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/py.typed +0 -0
  129. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/discovery/schema_resources.py +0 -0
  130. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/events.py +0 -0
  131. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/facade.py +0 -0
  132. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/frontmatter.py +0 -0
  133. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/health.py +0 -0
  134. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/identifier_resolver.py +0 -0
  135. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/lake.py +0 -0
  136. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/lockfiles.py +0 -0
  137. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/locking.py +0 -0
  138. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/matrix.py +0 -0
  139. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/models.py +0 -0
  140. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/oci_protocol.py +0 -0
  141. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/packs.py +0 -0
  142. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/policies.py +0 -0
  143. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/profiling.py +0 -0
  144. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/programs.py +0 -0
  145. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/project_sharing.py +0 -0
  146. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/publisher_verification.py +0 -0
  147. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/py.typed +0 -0
  148. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/references.py +0 -0
  149. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/resolver.py +0 -0
  150. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/schema_resources.py +0 -0
  151. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/serialization.py +0 -0
  152. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/specs.py +0 -0
  153. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/timings.py +0 -0
  154. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime/wire.py +0 -0
  155. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime.egg-info/dependency_links.txt +0 -0
  156. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime.egg-info/entry_points.txt +0 -0
  157. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime.egg-info/requires.txt +0 -0
  158. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/lean_runtime.egg-info/top_level.txt +0 -0
  159. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/schemas/attestation-v1.schema.json +0 -0
  160. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/schemas/check-batch-v1.schema.json +0 -0
  161. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/schemas/cleanup-v1.schema.json +0 -0
  162. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/schemas/comparison-v1.schema.json +0 -0
  163. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/schemas/execution-v1.schema.json +0 -0
  164. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/schemas/inspect-v1.schema.json +0 -0
  165. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/schemas/matrix-v1.schema.json +0 -0
  166. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/schemas/plan-v1.schema.json +0 -0
  167. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/schemas/profile-v1.schema.json +0 -0
  168. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/schemas/publication-v1.schema.json +0 -0
  169. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/schemas/verify-v1.schema.json +0 -0
  170. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/scripts/lake_cache_gate.py +0 -0
  171. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/scripts/run_compatibility.py +0 -0
  172. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/scripts/run_v1_case_study.py +0 -0
  173. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/scripts/smoke_wheel.py +0 -0
  174. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/setup.cfg +0 -0
  175. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/conftest.py +0 -0
  176. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/discovery/e2e/test_real_discovery.py +0 -0
  177. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/discovery/test_discovery_schema_resources.py +0 -0
  178. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_announcement_gate.py +0 -0
  179. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_backend.py +0 -0
  180. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_bundles.py +0 -0
  181. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_capsules.py +0 -0
  182. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_diagnostics.py +0 -0
  183. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_events_health.py +0 -0
  184. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_facade.py +0 -0
  185. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_frontmatter.py +0 -0
  186. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_git.py +0 -0
  187. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_header_cache.py +0 -0
  188. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_identifier_resolver.py +0 -0
  189. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_interactive.py +0 -0
  190. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_lockfiles.py +0 -0
  191. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_locking.py +0 -0
  192. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_models.py +0 -0
  193. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_multifile.py +0 -0
  194. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_oci_protocol.py +0 -0
  195. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_packs.py +0 -0
  196. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_paths.py +0 -0
  197. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_prebuilt_policy.py +0 -0
  198. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_programs.py +0 -0
  199. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_references.py +0 -0
  200. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_runtime.py +0 -0
  201. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_schema_resources.py +0 -0
  202. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_schemas.py +0 -0
  203. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_signatures.py +0 -0
  204. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_specs.py +0 -0
  205. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_store.py +0 -0
  206. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_toolchain_oci.py +0 -0
  207. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_toolchain_slim.py +0 -0
  208. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_v1_precision.py +0 -0
  209. {lean_runtime-4.0.0 → lean_runtime-4.1.0}/tests/test_verification_inventory.py +0 -0
@@ -2,6 +2,17 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.1.0 - 2026-08-19
6
+
7
+ ## 4.0.1 - 2026-08-18
8
+
9
+ - Keep `verify ENV --offline` strictly local for sparse environments by probing
10
+ a retained capsule module and forbidding projection acquisition during the
11
+ probe.
12
+ - Pin the selected exact toolchain before project scaffolding and put a reused
13
+ user toolchain ahead of private Elan for nested Lake commands, preventing
14
+ `new --core` from downloading an alternate unprefixed toolchain.
15
+
5
16
  ## 4.0.0 - 2026-08-18
6
17
 
7
18
  - Replace the implementation-shaped CLI with a cwd-first workflow: `new`,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lean-runtime
3
- Version: 4.0.0
3
+ Version: 4.1.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
@@ -36,14 +36,35 @@ Dynamic: license-file
36
36
 
37
37
  # Lean Runtime
38
38
 
39
- Lean Runtime makes Lean projects and standalone proofs work without asking you
40
- to manage toolchains, dependency checkouts, exact environments, or caches.
39
+ **Check the proof. Reuse everything else.**
41
40
 
42
41
  ```bash
43
42
  python -m pip install lean-runtime
44
43
  ```
45
44
 
46
- ## The daily workflow
45
+ Give Lean Runtime an ordinary file:
46
+
47
+ ```lean
48
+ -- Main.lean
49
+ import Mathlib
50
+
51
+ example : 2 + 2 = 4 := by norm_num
52
+ ```
53
+
54
+ ```console
55
+ $ lean-runtime check Main.lean
56
+ ✓ Main.lean accepted in 1.60s
57
+ ```
58
+
59
+ No Lake project, dependency checkout, or toolchain setup required. Lean Runtime
60
+ discovers and verifies the exact environment, then keeps it ready for offline
61
+ reuse.
62
+
63
+ [Get started](https://alerad.github.io/lean-runtime/getting-started/) ·
64
+ [Read the documentation](https://alerad.github.io/lean-runtime/) ·
65
+ [Explore the CLI](https://alerad.github.io/lean-runtime/cli/)
66
+
67
+ ## Start where you are
47
68
 
48
69
  Create a project:
49
70
 
@@ -77,7 +98,9 @@ lean-runtime check Main.lean
77
98
  ```
78
99
 
79
100
  The same command uses the nearest pinned Lake project when one exists and
80
- otherwise performs bounded exact-environment discovery. A file can carry its
101
+ otherwise performs bounded exact-environment discovery. Automatic discovery
102
+ uses retained or verified downloadable environments; building a missing
103
+ candidate from source requires `--allow-source-build`. A file can carry its
81
104
  context in strict comment frontmatter:
82
105
 
83
106
  ```lean
@@ -194,6 +217,5 @@ interfaces for infrastructure code.
194
217
  - Logical Lean rejections exit 1; invalid/infrastructure invocations exit 2;
195
218
  publication failures retain their documented classified exit statuses.
196
219
 
197
- Documentation lives in [`docs/`](docs/index.md). Start with
198
- [`docs/getting-started.md`](docs/getting-started.md),
199
- [`docs/cli.md`](docs/cli.md), and [`docs/local-projects.md`](docs/local-projects.md).
220
+ Documentation lives at
221
+ [alerad.github.io/lean-runtime](https://alerad.github.io/lean-runtime/).
@@ -1,13 +1,34 @@
1
1
  # Lean Runtime
2
2
 
3
- Lean Runtime makes Lean projects and standalone proofs work without asking you
4
- to manage toolchains, dependency checkouts, exact environments, or caches.
3
+ **Check the proof. Reuse everything else.**
5
4
 
6
5
  ```bash
7
6
  python -m pip install lean-runtime
8
7
  ```
9
8
 
10
- ## The daily workflow
9
+ Give Lean Runtime an ordinary file:
10
+
11
+ ```lean
12
+ -- Main.lean
13
+ import Mathlib
14
+
15
+ example : 2 + 2 = 4 := by norm_num
16
+ ```
17
+
18
+ ```console
19
+ $ lean-runtime check Main.lean
20
+ ✓ Main.lean accepted in 1.60s
21
+ ```
22
+
23
+ No Lake project, dependency checkout, or toolchain setup required. Lean Runtime
24
+ discovers and verifies the exact environment, then keeps it ready for offline
25
+ reuse.
26
+
27
+ [Get started](https://alerad.github.io/lean-runtime/getting-started/) ·
28
+ [Read the documentation](https://alerad.github.io/lean-runtime/) ·
29
+ [Explore the CLI](https://alerad.github.io/lean-runtime/cli/)
30
+
31
+ ## Start where you are
11
32
 
12
33
  Create a project:
13
34
 
@@ -41,7 +62,9 @@ lean-runtime check Main.lean
41
62
  ```
42
63
 
43
64
  The same command uses the nearest pinned Lake project when one exists and
44
- otherwise performs bounded exact-environment discovery. A file can carry its
65
+ otherwise performs bounded exact-environment discovery. Automatic discovery
66
+ uses retained or verified downloadable environments; building a missing
67
+ candidate from source requires `--allow-source-build`. A file can carry its
45
68
  context in strict comment frontmatter:
46
69
 
47
70
  ```lean
@@ -158,6 +181,5 @@ interfaces for infrastructure code.
158
181
  - Logical Lean rejections exit 1; invalid/infrastructure invocations exit 2;
159
182
  publication failures retain their documented classified exit statuses.
160
183
 
161
- Documentation lives in [`docs/`](docs/index.md). Start with
162
- [`docs/getting-started.md`](docs/getting-started.md),
163
- [`docs/cli.md`](docs/cli.md), and [`docs/local-projects.md`](docs/local-projects.md).
184
+ Documentation lives at
185
+ [alerad.github.io/lean-runtime](https://alerad.github.io/lean-runtime/).
@@ -7,7 +7,6 @@ channel = "stable"
7
7
  lock = "locks/core-v4.32.2.lock.json"
8
8
  inventory_packages = []
9
9
  modules = ["Init", "Lean", "Std"]
10
- library_hints = []
11
10
  created_at = "2026-08-08T16:24:59Z"
12
11
 
13
12
  [[environment]]
@@ -16,7 +15,6 @@ channel = "stable"
16
15
  lock = "locks/mathlib-v4.32.2.lock.json"
17
16
  references = ["github:leanprover-community/mathlib4@v4.32.2"]
18
17
  inventory_packages = ["mathlib"]
19
- library_hints = []
20
18
  created_at = "2026-07-28T18:36:13+02:00"
21
19
 
22
20
  [[environment]]
@@ -25,7 +23,6 @@ channel = "stable"
25
23
  lock = "locks/mathlib-v4.33.0.lock.json"
26
24
  references = ["github:leanprover-community/mathlib4@v4.33.0"]
27
25
  inventory_packages = ["mathlib"]
28
- library_hints = []
29
26
  created_at = "2026-08-10T09:12:31Z"
30
27
 
31
28
  [[environment]]
@@ -34,7 +31,6 @@ channel = "stable"
34
31
  lock = "locks/mathlib-v4.31.0.lock.json"
35
32
  references = ["github:leanprover-community/mathlib4@v4.31.0"]
36
33
  inventory_packages = ["mathlib"]
37
- library_hints = []
38
34
  created_at = "2026-06-15T14:22:22Z"
39
35
 
40
36
  [[environment]]
@@ -43,7 +39,6 @@ channel = "stable"
43
39
  lock = "locks/mathlib-v4.30.0.lock.json"
44
40
  references = ["github:leanprover-community/mathlib4@v4.30.0"]
45
41
  inventory_packages = ["mathlib"]
46
- library_hints = []
47
42
  created_at = "2026-05-26T18:25:31Z"
48
43
 
49
44
  [[environment]]
@@ -55,7 +50,6 @@ references = [
55
50
  "github:leanprover-community/mathlib4@v4.30.0",
56
51
  ]
57
52
  inventory_packages = ["LeanCert", "mathlib"]
58
- library_hints = []
59
53
  created_at = "2026-06-14T03:06:27Z"
60
54
 
61
55
  [[environment]]
@@ -67,7 +61,6 @@ references = [
67
61
  "github:leanprover-community/mathlib4@v4.31.0",
68
62
  ]
69
63
  inventory_packages = ["LeanCert", "mathlib"]
70
- library_hints = []
71
64
  created_at = "2026-06-18T16:14:44Z"
72
65
 
73
66
  [[environment]]
@@ -79,7 +72,6 @@ references = [
79
72
  "github:leanprover-community/mathlib4@v4.32.2",
80
73
  ]
81
74
  inventory_packages = ["LeanCert", "mathlib"]
82
- library_hints = []
83
75
  created_at = "2026-08-01T10:49:16Z"
84
76
 
85
77
  [[environment]]
@@ -91,5 +83,4 @@ references = [
91
83
  "github:leanprover-community/mathlib4@v4.33.0",
92
84
  ]
93
85
  inventory_packages = ["LeanCert", "mathlib"]
94
- library_hints = []
95
86
  created_at = "2026-08-10T22:05:27Z"
@@ -0,0 +1,54 @@
1
+ # Context selection
2
+
3
+ Every check runs inside one selected context. Context selection and compiler acceptance are separate decisions.
4
+
5
+ ## Precedence
6
+
7
+ For a Lean file, Lean Runtime considers context sources in this order:
8
+
9
+ 1. An explicit command-line or Python API context
10
+ 2. Lean Runtime frontmatter in the file
11
+ 3. The nearest pinned Lake project
12
+ 4. Automatic catalog discovery
13
+
14
+ If none can produce a context, the operation fails before Lean runs.
15
+
16
+ ## Explicit context
17
+
18
+ ```console
19
+ lean-runtime check Main.lean --using mathlib@v4.33.0
20
+ ```
21
+
22
+ An explicit context can identify a project, lock file, stored environment, toolchain, or package reference. Explicit input does not need discovery.
23
+
24
+ ## Frontmatter
25
+
26
+ ```lean
27
+ -- /// lean-runtime
28
+ -- toolchain = "leanprover/lean4:v4.33.0"
29
+ -- ///
30
+ example : 1 + 1 = 2 := by decide
31
+ ```
32
+
33
+ Frontmatter travels with the source while remaining valid Lean comments.
34
+
35
+ ## Pinned project context
36
+
37
+ A file beneath a Lake project uses the nearest project with both a pinned toolchain and manifest. Lean Runtime does not replace those version decisions during a normal project check.
38
+
39
+ ## Automatic discovery
40
+
41
+ Discovery begins with declared source imports. The bundled catalog associates exact environments with module inventories. Plausible candidates are ordered under a bounded policy and checked in turn.
42
+
43
+ Static analysis proposes candidates. It does not prove compatibility. A candidate is accepted only if Lean accepts the source inside that exact environment.
44
+
45
+ Candidate count, compiler time, wall time, remote acquisition, offline mode, and source-build permission can bound the search. Reaching a bound can produce an inconclusive discovery result rather than a claim that no compatible environment exists.
46
+
47
+ ## Inspect the decision
48
+
49
+ ```console
50
+ lean-runtime status Main.lean
51
+ lean-runtime status Main.lean --json
52
+ ```
53
+
54
+ `status` reports evidence and routing. A successful `check` reports compiler acceptance and execution provenance.
@@ -0,0 +1,118 @@
1
+ ---
2
+ hide:
3
+ - navigation
4
+ - toc
5
+ - footer
6
+ ---
7
+
8
+ <nav class="lr-topbar" aria-label="Main navigation">
9
+ <div class="lr-topbar-inner">
10
+ <a class="lr-wordmark" href="./">lean<span>-</span>runtime</a>
11
+ <span class="lr-version-chip">Lean 4 · Python 3.10+</span>
12
+ <div class="lr-topnav">
13
+ <a href="tutorial/">Start</a>
14
+ <a href="workflows/check-files/">Workflows</a>
15
+ <a href="concepts/context-selection/">Concepts</a>
16
+ <a href="reference/commands/">Reference</a>
17
+ <a href="trust/">Trust</a>
18
+ <a href="https://github.com/alerad/lean-runtime">GitHub</a>
19
+ </div>
20
+ </div>
21
+ </nav>
22
+
23
+ <section class="lr-hero" data-run-demo>
24
+ <div class="lr-hero-copy">
25
+ <p class="lr-eyebrow"><span aria-hidden="true">⊢</span> Compiler-backed Lean execution</p>
26
+ <h1>Check a Lean file in the environment it needs.</h1>
27
+ <p class="lr-lead">Lean Runtime resolves an exact toolchain and dependency context, runs Lean, and records what actually ran.</p>
28
+ <div class="lr-actions">
29
+ <a class="md-button md-button--primary" href="tutorial/">Run your first check</a>
30
+ <a class="md-button" href="concepts/context-selection/">How context is selected</a>
31
+ </div>
32
+ <div class="lr-install" aria-label="Install command">
33
+ <code>python -m pip install lean-runtime</code>
34
+ <button type="button" data-copy-install aria-label="Copy install command">Copy</button>
35
+ </div>
36
+ <p class="lr-platform-note">Python 3.10 or newer and Git are required. Automatic Elan bootstrap is available on macOS and Linux.</p>
37
+ </div>
38
+
39
+ <div class="lr-instrument" aria-label="Interactive Lean Runtime example">
40
+ <div class="lr-mode-tabs" role="tablist" aria-label="Execution context">
41
+ <button type="button" role="tab" aria-selected="true" data-demo-mode="automatic">Automatic</button>
42
+ <button type="button" role="tab" aria-selected="false" data-demo-mode="pinned">Pinned</button>
43
+ <button type="button" role="tab" aria-selected="false" data-demo-mode="project">Lake project</button>
44
+ </div>
45
+
46
+ <div class="lr-source-pane">
47
+ <div class="lr-pane-bar">
48
+ <span class="lr-pane-dot" aria-hidden="true"></span>
49
+ <span data-source-name>Primes.lean</span>
50
+ <span class="lr-pane-context" data-source-context>standalone file</span>
51
+ </div>
52
+ <pre data-source><code><span class="lr-kw">import</span> <mark>Mathlib.Data.Nat.Prime.Infinite</mark>
53
+
54
+ <span class="lr-kw">example</span> : ∀ n : ℕ, ∃ p, n ≤ p ∧ p.Prime :=
55
+ Nat.exists_infinite_primes</code></pre>
56
+ </div>
57
+
58
+ <div class="lr-terminal-pane">
59
+ <div class="lr-pane-bar">
60
+ <span class="lr-pane-dot" aria-hidden="true"></span>
61
+ terminal
62
+ <span class="lr-pane-context" data-run-state>ready</span>
63
+ </div>
64
+ <div class="lr-terminal" data-terminal aria-live="polite"></div>
65
+ </div>
66
+
67
+ <div class="lr-demo-controls">
68
+ <button type="button" class="lr-replay" data-replay><span aria-hidden="true">↻</span> Replay</button>
69
+ <button type="button" class="lr-inspect-button" data-inspect aria-expanded="false">Inspect this run</button>
70
+ </div>
71
+
72
+ <div class="lr-run-record" data-run-record hidden>
73
+ <dl>
74
+ <div><dt>Context source</dt><dd data-record-context>automatic discovery</dd></div>
75
+ <div><dt>Toolchain</dt><dd><code>leanprover/lean4:v4.33.0</code></dd></div>
76
+ <div><dt>Environment</dt><dd><code>mathlib-v4.33.0</code></dd></div>
77
+ <div><dt>Verdict</dt><dd class="lr-accepted">accepted</dd></div>
78
+ </dl>
79
+ <p>The environment is proposed from source evidence. The verdict is produced by Lean.</p>
80
+ </div>
81
+ </div>
82
+ </section>
83
+
84
+
85
+
86
+ <section class="lr-workflows" aria-labelledby="workflows-title">
87
+ <div class="lr-section-heading">
88
+ <p class="lr-kicker">Workflows</p>
89
+ <h2 id="workflows-title">Use the entry point that matches your work.</h2>
90
+ </div>
91
+ <div class="lr-card-grid">
92
+ <article>
93
+ <p class="lr-card-label">Standalone file</p>
94
+ <h3>Bring a Lean source file</h3>
95
+ <pre><code>lean-runtime check Main.lean</code></pre>
96
+ <p>Use automatic discovery, a package reference, frontmatter, or an exact lock.</p>
97
+ <a href="workflows/check-files/">Check Lean files</a>
98
+ </article>
99
+ <article>
100
+ <p class="lr-card-label">Lake project</p>
101
+ <h3>Keep the project authoritative</h3>
102
+ <pre><code>lean-runtime adopt . --yes
103
+ lean-runtime build</code></pre>
104
+ <p>The project keeps its pinned toolchain and manifest. Dependency storage and compatible artifacts can be reused.</p>
105
+ <a href="workflows/lake-projects/">Work with Lake projects</a>
106
+ </article>
107
+ <article>
108
+ <p class="lr-card-label">Exact and offline</p>
109
+ <h3>Record the environment</h3>
110
+ <pre><code>lean-runtime check Main.lean \
111
+ --lock-out environment.lock.json</code></pre>
112
+ <p>Reuse the resulting lock explicitly, including with network access disabled.</p>
113
+ <a href="workflows/check-files/#record-and-reuse-an-exact-lock">Use an exact lock</a>
114
+ </article>
115
+ </div>
116
+ </section>
117
+
118
+
@@ -0,0 +1,67 @@
1
+ # Commands
2
+
3
+ This page summarizes the command surface. Run `lean-runtime COMMAND --help` for the installed version's complete arguments and options.
4
+
5
+ ## Daily workflows
6
+
7
+ | Command | Purpose |
8
+ | --- | --- |
9
+ | `new NAME` | Create a Lean project. |
10
+ | `adopt [PATH]` | Register existing Lake projects and prepare shared dependency storage. |
11
+ | `check [PATH ...]` | Check a project or Lean source with inferred or explicit context. |
12
+ | `watch FILE` | Recheck one project file when it changes. |
13
+ | `build [TARGET ...]` | Build the current Lake project. |
14
+ | `update [PATH]` | Apply the latest cataloged Mathlib/toolchain update; non-Mathlib projects are a no-op. |
15
+ | `publish [PATH]` | Configure project publication. |
16
+
17
+ ## Inspection and maintenance
18
+
19
+ | Command | Purpose |
20
+ | --- | --- |
21
+ | `status [SUBJECT]` | Explain the selected project or standalone context. |
22
+ | `verify SUBJECT` | Verify a lock, environment, or artifact. |
23
+ | `doctor` | Diagnose the local installation and configuration. |
24
+ | `clean` | Preview and reclaim unused runtime storage. |
25
+ | `replay CAPTURE` | Replay an execution capture. |
26
+ | `completion SHELL` | Generate shell completion. |
27
+
28
+ ## Advanced namespaces
29
+
30
+ | Namespace | Scope |
31
+ | --- | --- |
32
+ | `env` | Exact immutable environments and locks. |
33
+ | `project` | Mutable project inspection, sharing, locks, and exports. |
34
+ | `toolchain` | Toolchain installation, inspection, optimization, and publication. |
35
+ | `storage` | Storage usage and verification. |
36
+ | `program` | Ready-to-run program artifacts. |
37
+ | `catalog` | Discovery catalog maintenance. |
38
+
39
+ ## Common check options
40
+
41
+ ```console
42
+ lean-runtime check Main.lean --using CONTEXT
43
+ lean-runtime check Main.lean --offline
44
+ lean-runtime check Main.lean --json
45
+ lean-runtime check Main.lean --timings
46
+ lean-runtime check Main.lean --repeat 10
47
+ ```
48
+
49
+ `--allow-source-build` permits standalone discovery to build an environment from source when no suitable acquired form is available.
50
+
51
+ ## Build cache control
52
+
53
+ ```console
54
+ lean-runtime build
55
+ lean-runtime build --no-cache
56
+ ```
57
+
58
+ The default build may restore supported dependency artifacts before invoking Lake. `--no-cache` skips that restoration step.
59
+
60
+ ## Exit codes for check
61
+
62
+ | Code | Meaning |
63
+ | --- | --- |
64
+ | `0` | Lean accepted the source. |
65
+ | `1` | Lean ran and rejected the source. |
66
+ | `2` | Invocation, context, acquisition, or configuration failed. |
67
+ | `130` | Interrupted. |
@@ -0,0 +1,200 @@
1
+ # Python API
2
+
3
+ Set up one context, then check as many sources as you like. The expensive work
4
+ happens on the first call; everything after it reuses the prepared environment.
5
+
6
+ ## Select a context
7
+
8
+ `setup()` prepares one context and returns a handle:
9
+
10
+ ```python
11
+ import lean_runtime as lean
12
+
13
+ environment = lean.setup(["mathlib@v4.33.0"])
14
+ locked = lean.setup(lock="environment.lock.json")
15
+ existing = lean.setup(environment="research-stack")
16
+ core = lean.setup(toolchain="v4.33.0")
17
+ project = lean.setup(project="./my-project")
18
+ ```
19
+
20
+ Exactly one of `deps`, `project`, `lock`, `environment`, or a bare `toolchain`
21
+ is required. The same precedence applies here as on the command line; see
22
+ [Context selection](../concepts/context-selection.md).
23
+
24
+ Importing `lean_runtime` has no filesystem or network side effects. The default
25
+ `Runtime` is created on the first operation. Pass `runtime=Runtime(...)` to any
26
+ function for explicit configuration.
27
+
28
+ ## Check a source
29
+
30
+ ```python
31
+ result = environment.check(source)
32
+ result = environment.check_files(files, entrypoint="Main.lean")
33
+ results = environment.check_many(sources, concurrency=8)
34
+ ```
35
+
36
+ One-shot helpers route the same way:
37
+
38
+ ```python
39
+ result = lean.check(source, deps=["mathlib@v4.33.0"])
40
+ result = lean.check_file("./my-project/MyProject/Main.lean")
41
+ result = lean.replay("execution.capture.json")
42
+ ```
43
+
44
+ `replay()` requires an existing execution capture; the filename above is a
45
+ placeholder for an artifact supplied by the caller or an execution backend.
46
+
47
+ ## Read the result
48
+
49
+ Failed checks expose parsed diagnostics directly:
50
+
51
+ ```python
52
+ for error in result.errors:
53
+ print(error.file, error.line, error.message)
54
+
55
+ if result.first_error is not None:
56
+ print(result.first_error.location)
57
+ ```
58
+
59
+ `errors` and `warnings` are severity-filtered views of `diagnostics`. Diagnostic
60
+ extraction is best-effort; `stdout` and `stderr` remain authoritative.
61
+
62
+ Scripts that prefer exceptions can use `result.raise_for_error()`, which raises
63
+ `LeanCheckError` on rejection. Its `result` attribute retains diagnostics,
64
+ output, environment and execution identities, and provenance.
65
+
66
+ ## Discover an environment
67
+
68
+ `lean-runtime check FILE` discovers a context automatically for standalone
69
+ files. The same bounded, compiler-authoritative search is available directly:
70
+
71
+ ```python
72
+ from lean_runtime.discovery import Discovery, default_catalog
73
+
74
+ discovery = Discovery(catalog=default_catalog())
75
+ result = discovery.discover_and_check("""
76
+ import Mathlib
77
+ example : 2 + 2 = 4 := by norm_num
78
+ """)
79
+ result.raise_for_error()
80
+
81
+ print(result.lock_id)
82
+ print(result.environment_id)
83
+ ```
84
+
85
+ Every successful result carries the exact `EnvironmentLock` Lean accepted. Pass
86
+ that lock to ordinary operations to skip discovery on later runs.
87
+
88
+ `outcome` and `completion` are reported separately, so a search stopped by a
89
+ candidate, acquisition, or time limit reads as inconclusive rather than as an
90
+ exhaustive rejection:
91
+
92
+ ```python
93
+ if result.outcome == "inconclusive":
94
+ print(result.completion) # candidate_limit | acquisition_limit | time_limit
95
+ ```
96
+
97
+ Planning metadata narrows candidates. It never asserts compatibility.
98
+
99
+ ## Bound an execution
100
+
101
+ ```python
102
+ from lean_runtime import ExecutionPolicy
103
+
104
+ policy = ExecutionPolicy(
105
+ timeout_seconds=30,
106
+ max_output_bytes=1_000_000,
107
+ cpu_seconds=20,
108
+ )
109
+ result = environment.check(source, policy=policy)
110
+ ```
111
+
112
+ Consult `result.provenance.enforced_policy_fields`: requested controls vary by
113
+ backend and platform. The local backend rejects network isolation because it
114
+ cannot enforce it. Memory limits are also backend-dependent. In particular,
115
+ the local Linux backend currently applies `memory_mb` as a virtual-address-space
116
+ limit, so Lean may need substantially more headroom than its resident memory
117
+ suggests. Add that limit only after measuring the selected toolchain and backend.
118
+
119
+ ## Provenance
120
+
121
+ `ExecutionResult` records the exit code, command, output, duration, phase
122
+ timings, timeout/cancellation/truncation flags, diagnostics, and provenance.
123
+ Provenance includes the `execution_id`, a stable `request_digest`, environment
124
+ and lock identities, exact package commits and Git tree hashes, toolchain,
125
+ platform, backend, policy, source digest, and start time.
126
+
127
+ Mutable project results have no environment or lock identity. Their provenance
128
+ instead records the canonical root, a workspace digest excluding `.git` and
129
+ `.lake`, Lake configuration and manifest digests, and Git revision state.
130
+
131
+ ## Work with Lake projects
132
+
133
+ ```python
134
+ project = runtime.project("./existing-project")
135
+ project.check_file("./existing-project/MyLibrary/Main.lean")
136
+ project.build(("MyLibrary",))
137
+ ```
138
+
139
+ `build()` may restore dependency artifacts before invoking Lake. Opt out when
140
+ measuring, or when a source-only build is required:
141
+
142
+ ```python
143
+ project.build(("MyLibrary",), artifact_cache=False)
144
+ ```
145
+
146
+ `runtime.project()` also accepts a contained file and resolves the nearest
147
+ pinned Lake root. See [Work with Lake projects](../workflows/lake-projects.md).
148
+
149
+ ## Cancel work in flight
150
+
151
+ ```python
152
+ job = environment.start_check(source)
153
+ if no_longer_needed:
154
+ job.cancel()
155
+ result = job.result()
156
+ ```
157
+
158
+ `cancel()` returns `False` once the job has completed. Cancellation is
159
+ cooperative and terminates the local child process.
160
+
161
+ The asyncio helpers preserve that behaviour:
162
+
163
+ ```python
164
+ result = await environment.check_async(source)
165
+ results = await environment.check_many_async(sources, concurrency=8)
166
+ ```
167
+
168
+ Synchronous `setup()`, `check()`, and `Runtime.prepare()` accept a
169
+ `threading.Event` through `cancel=`, which interrupts toolchain installation,
170
+ Lake resolution, and environment builds.
171
+
172
+ ## Keep a tool alive
173
+
174
+ `spawn_interactive()` holds one process open inside a disposable instance and
175
+ exposes line-buffered UTF-8 pipes, for REPLs, language servers, and NDJSON
176
+ bridges where startup cost should be paid once:
177
+
178
+ ```python
179
+ with environment.spawn_interactive(["lake", "exe", "lean_bridge"]) as session:
180
+ response = session.request_json({"id": 1, "method": "get_info", "params": {}})
181
+
182
+ result = session.close()
183
+ ```
184
+
185
+ `close()` is idempotent, closes stdin first so cooperative servers exit on EOF,
186
+ then terminates the process group if needed. `send_line()`, `read_line()`,
187
+ `request_line()`, and `request_json()` are locked so concurrent callers cannot
188
+ interleave protocol frames. `lean_bridge` is an example project executable, not
189
+ a program bundled with Lean Runtime; replace it with a line-oriented tool provided
190
+ by the selected environment.
191
+
192
+ ## Observe progress
193
+
194
+ ```python
195
+ runtime = Runtime(on_event=lambda event: print(event.kind, event.data))
196
+ ```
197
+
198
+ Events are typed `RuntimeEvent` values, not parsed log lines. They cover
199
+ toolchain readiness, Lake resolution, source locking, artifact restoration,
200
+ builds, publication, and environment reuse.