machinechecked 0.1.11__tar.gz → 0.1.13__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.
- machinechecked-0.1.13/PKG-INFO +111 -0
- machinechecked-0.1.13/README.md +87 -0
- machinechecked-0.1.13/engine/python/machinechecked.egg-info/PKG-INFO +111 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/machinechecked.egg-info/SOURCES.txt +7 -2
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/assess.py +55 -33
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/audit.py +1 -1
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/cache.py +72 -16
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/cli.py +7 -9
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/data/ProofLensProbe.lean +62 -24
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/data/schema/inventory.schema.json +9 -0
- machinechecked-0.1.13/engine/python/prooflens/data/schema/manifest-claim.schema.json +319 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/data/schema/manifest-index.schema.json +47 -2
- machinechecked-0.1.13/engine/python/prooflens/data/statuses.json +439 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/export.py +4 -8
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/manifest.py +46 -63
- machinechecked-0.1.13/engine/python/prooflens/paper.py +202 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/pdfclaims.py +87 -24
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/pipeline.py +3 -17
- machinechecked-0.1.13/engine/python/prooflens/published.py +162 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/simple.py +28 -24
- machinechecked-0.1.13/engine/python/prooflens/source_regions.py +260 -0
- machinechecked-0.1.13/engine/python/prooflens/status.py +33 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/symbols.py +54 -10
- machinechecked-0.1.13/engine/python/prooflens/web/assets/cursor-editorTextHighlight-kG3uUOwL.svg +8 -0
- machinechecked-0.1.13/engine/python/prooflens/web/assets/index-DevCW_Pm.js +278 -0
- machinechecked-0.1.13/engine/python/prooflens/web/assets/index-GfZV3aEH.css +1 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/index.html +2 -2
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/theme.css +10 -4
- {machinechecked-0.1.11 → machinechecked-0.1.13}/pyproject.toml +1 -1
- machinechecked-0.1.11/PKG-INFO +0 -110
- machinechecked-0.1.11/README.md +0 -86
- machinechecked-0.1.11/engine/python/machinechecked.egg-info/PKG-INFO +0 -110
- machinechecked-0.1.11/engine/python/prooflens/data/schema/manifest-claim.schema.json +0 -126
- machinechecked-0.1.11/engine/python/prooflens/paper.py +0 -149
- machinechecked-0.1.11/engine/python/prooflens/web/assets/index-B7NQsymB.css +0 -1
- machinechecked-0.1.11/engine/python/prooflens/web/assets/index-BtJVnEBn.js +0 -286
- {machinechecked-0.1.11 → machinechecked-0.1.13}/LICENSE +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/machinechecked.egg-info/dependency_links.txt +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/machinechecked.egg-info/entry_points.txt +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/machinechecked.egg-info/requires.txt +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/machinechecked.egg-info/top_level.txt +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/__init__.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/__main__.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/bundle.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/config.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/data/prooflens.sty +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/data/schema/evidence.schema.json +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/deps.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/evidence.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/formalization.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/probe.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/promote.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/replay.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/review_cli.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/review_queue.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/reviews.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/schemas.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/server.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/sources.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/tex.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/util.py +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/prooflens/web/assets/pdf.worker.min-yatZIOMy.mjs +0 -0
- {machinechecked-0.1.11 → machinechecked-0.1.13}/setup.cfg +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: machinechecked
|
|
3
|
+
Version: 0.1.13
|
|
4
|
+
Summary: Read a mathematical paper beside its Lean formalisation, and see claim by claim what Lean establishes.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Project-URL: Homepage, https://machinechecked.org
|
|
7
|
+
Project-URL: Documentation, https://github.com/cgarryZA/MachineChecked/blob/main/docs/GETTING_STARTED.md
|
|
8
|
+
Project-URL: Source, https://github.com/cgarryZA/MachineChecked
|
|
9
|
+
Project-URL: Issues, https://github.com/cgarryZA/MachineChecked/issues
|
|
10
|
+
Keywords: lean,lean4,formal verification,formalization,mathematics,proof,theorem prover,mathlib,audit,latex
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: jsonschema>=4
|
|
20
|
+
Requires-Dist: pyyaml>=6
|
|
21
|
+
Provides-Extra: test
|
|
22
|
+
Requires-Dist: pytest>=7; extra == "test"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# MachineChecked
|
|
26
|
+
|
|
27
|
+
**Read a mathematical paper beside its Lean formalisation.**
|
|
28
|
+
|
|
29
|
+
Select a statement to inspect its Lean counterpart, proof results and correspondence reviews.
|
|
30
|
+
MachineChecked runs locally in your Lean project and saves the links you choose.
|
|
31
|
+
|
|
32
|
+
[Try the demo](https://machinechecked.org/demo/) · [Browse papers](https://machinechecked.org/papers/) · [Setup guide](docs/GETTING_STARTED.md)
|
|
33
|
+
|
|
34
|
+
## Open your paper
|
|
35
|
+
|
|
36
|
+
From your Lean project's directory:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
lake build
|
|
40
|
+
uvx machinechecked view
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
MachineChecked finds the paper and opens the reader. You can also name a LaTeX file, PDF or URL:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
uvx machinechecked view paper/main.tex
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Requires Python 3.11+, your project's Lean toolchain, and TeX Live for LaTeX or Poppler for PDFs.
|
|
50
|
+
The web reader is included. For a persistent command, run `uv tool install machinechecked`;
|
|
51
|
+
then use `machinechecked` directly.
|
|
52
|
+
|
|
53
|
+
Select a claim from the contents or paper margin. **Expand comparison** shows the paper,
|
|
54
|
+
complete readable statement and exact Lean together. Follow existing `\lean{...}` tags, confirm a
|
|
55
|
+
suggestion, or choose a declaration. The reader saves your choices in `machinechecked.links.json`.
|
|
56
|
+
Projects with a `formalization.yaml` supply their paper sources and declared links automatically.
|
|
57
|
+
|
|
58
|
+
## Read the evidence
|
|
59
|
+
|
|
60
|
+
A Lean proof establishes a formal proposition. A correspondence review compares that proposition
|
|
61
|
+
and its definitions with the paper. Source checks identify the audited text; independent kernel
|
|
62
|
+
replay checks the proof again. The reader shows each result and its provenance in **Audit details**.
|
|
63
|
+
|
|
64
|
+
The optional **Review** view guides you through three steps:
|
|
65
|
+
|
|
66
|
+
1. Read the paper and record your interpretation.
|
|
67
|
+
2. Compare the Lean statement's assumptions and conclusion; record a verdict.
|
|
68
|
+
3. Read the author's review, save your report in the browser, and export it.
|
|
69
|
+
|
|
70
|
+
The maintainer evaluates reports and promotes reviews into the project's acceptance records.
|
|
71
|
+
[Review guide →](docs/REVIEWING.md)
|
|
72
|
+
|
|
73
|
+
## Share the reader
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
uvx machinechecked build # .machinechecked/MachineChecked.html
|
|
77
|
+
uvx machinechecked build --site public/ # a static site with audit.json
|
|
78
|
+
uvx machinechecked check # check linked declarations for automation
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The HTML file opens directly in a browser. It includes the paper, Lean statements and audit data;
|
|
82
|
+
review those contents before publishing. Host the site directory on GitHub Pages or another static
|
|
83
|
+
host. Published audits carry their author's name, project commit and paper revision.
|
|
84
|
+
|
|
85
|
+
**Copy link** shares a claim. **Report issue** opens a draft in the audit's GitHub repository,
|
|
86
|
+
with the claim identifier, declarations and commits filled in. Set that repository with
|
|
87
|
+
`--issues owner/repo`.
|
|
88
|
+
|
|
89
|
+
## With a coding agent
|
|
90
|
+
|
|
91
|
+
`machinechecked check --json` prints structured results for scripts and agents. The
|
|
92
|
+
[MachineChecked skill](skills/machinechecked/SKILL.md) covers commands, status codes and evidence.
|
|
93
|
+
[Agent guide →](docs/AGENTS.md)
|
|
94
|
+
|
|
95
|
+
## Full assessment
|
|
96
|
+
|
|
97
|
+
Projects with locked specifications, a claim inventory and review records can configure
|
|
98
|
+
`machinechecked.toml`. Full assessment adds exact-type checks, definition-dependent reviews,
|
|
99
|
+
witnesses, refutations and independent kernel replay.
|
|
100
|
+
[Configuration guide →](docs/ASSURANCE.md)
|
|
101
|
+
|
|
102
|
+
## Documentation
|
|
103
|
+
|
|
104
|
+
- [Get started](docs/GETTING_STARTED.md) — install, open, link, share and troubleshoot
|
|
105
|
+
- [Reviewing](docs/REVIEWING.md) — record mathematical judgements
|
|
106
|
+
- [Full assessment](docs/ASSURANCE.md) — configuration and acceptance
|
|
107
|
+
- [Evidence policy](docs/EVIDENCE_POLICY.md) — what each check establishes
|
|
108
|
+
- [Data model](docs/DATA_MODEL.md) · [Publication policy](docs/PUBLICATION_POLICY.md) · [Threat model](docs/THREAT_MODEL.md)
|
|
109
|
+
- [Development](docs/DEVELOPMENT.md) · [Plan](PLAN.md)
|
|
110
|
+
|
|
111
|
+
Apache-2.0 licensed.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# MachineChecked
|
|
2
|
+
|
|
3
|
+
**Read a mathematical paper beside its Lean formalisation.**
|
|
4
|
+
|
|
5
|
+
Select a statement to inspect its Lean counterpart, proof results and correspondence reviews.
|
|
6
|
+
MachineChecked runs locally in your Lean project and saves the links you choose.
|
|
7
|
+
|
|
8
|
+
[Try the demo](https://machinechecked.org/demo/) · [Browse papers](https://machinechecked.org/papers/) · [Setup guide](docs/GETTING_STARTED.md)
|
|
9
|
+
|
|
10
|
+
## Open your paper
|
|
11
|
+
|
|
12
|
+
From your Lean project's directory:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
lake build
|
|
16
|
+
uvx machinechecked view
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
MachineChecked finds the paper and opens the reader. You can also name a LaTeX file, PDF or URL:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
uvx machinechecked view paper/main.tex
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Requires Python 3.11+, your project's Lean toolchain, and TeX Live for LaTeX or Poppler for PDFs.
|
|
26
|
+
The web reader is included. For a persistent command, run `uv tool install machinechecked`;
|
|
27
|
+
then use `machinechecked` directly.
|
|
28
|
+
|
|
29
|
+
Select a claim from the contents or paper margin. **Expand comparison** shows the paper,
|
|
30
|
+
complete readable statement and exact Lean together. Follow existing `\lean{...}` tags, confirm a
|
|
31
|
+
suggestion, or choose a declaration. The reader saves your choices in `machinechecked.links.json`.
|
|
32
|
+
Projects with a `formalization.yaml` supply their paper sources and declared links automatically.
|
|
33
|
+
|
|
34
|
+
## Read the evidence
|
|
35
|
+
|
|
36
|
+
A Lean proof establishes a formal proposition. A correspondence review compares that proposition
|
|
37
|
+
and its definitions with the paper. Source checks identify the audited text; independent kernel
|
|
38
|
+
replay checks the proof again. The reader shows each result and its provenance in **Audit details**.
|
|
39
|
+
|
|
40
|
+
The optional **Review** view guides you through three steps:
|
|
41
|
+
|
|
42
|
+
1. Read the paper and record your interpretation.
|
|
43
|
+
2. Compare the Lean statement's assumptions and conclusion; record a verdict.
|
|
44
|
+
3. Read the author's review, save your report in the browser, and export it.
|
|
45
|
+
|
|
46
|
+
The maintainer evaluates reports and promotes reviews into the project's acceptance records.
|
|
47
|
+
[Review guide →](docs/REVIEWING.md)
|
|
48
|
+
|
|
49
|
+
## Share the reader
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
uvx machinechecked build # .machinechecked/MachineChecked.html
|
|
53
|
+
uvx machinechecked build --site public/ # a static site with audit.json
|
|
54
|
+
uvx machinechecked check # check linked declarations for automation
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The HTML file opens directly in a browser. It includes the paper, Lean statements and audit data;
|
|
58
|
+
review those contents before publishing. Host the site directory on GitHub Pages or another static
|
|
59
|
+
host. Published audits carry their author's name, project commit and paper revision.
|
|
60
|
+
|
|
61
|
+
**Copy link** shares a claim. **Report issue** opens a draft in the audit's GitHub repository,
|
|
62
|
+
with the claim identifier, declarations and commits filled in. Set that repository with
|
|
63
|
+
`--issues owner/repo`.
|
|
64
|
+
|
|
65
|
+
## With a coding agent
|
|
66
|
+
|
|
67
|
+
`machinechecked check --json` prints structured results for scripts and agents. The
|
|
68
|
+
[MachineChecked skill](skills/machinechecked/SKILL.md) covers commands, status codes and evidence.
|
|
69
|
+
[Agent guide →](docs/AGENTS.md)
|
|
70
|
+
|
|
71
|
+
## Full assessment
|
|
72
|
+
|
|
73
|
+
Projects with locked specifications, a claim inventory and review records can configure
|
|
74
|
+
`machinechecked.toml`. Full assessment adds exact-type checks, definition-dependent reviews,
|
|
75
|
+
witnesses, refutations and independent kernel replay.
|
|
76
|
+
[Configuration guide →](docs/ASSURANCE.md)
|
|
77
|
+
|
|
78
|
+
## Documentation
|
|
79
|
+
|
|
80
|
+
- [Get started](docs/GETTING_STARTED.md) — install, open, link, share and troubleshoot
|
|
81
|
+
- [Reviewing](docs/REVIEWING.md) — record mathematical judgements
|
|
82
|
+
- [Full assessment](docs/ASSURANCE.md) — configuration and acceptance
|
|
83
|
+
- [Evidence policy](docs/EVIDENCE_POLICY.md) — what each check establishes
|
|
84
|
+
- [Data model](docs/DATA_MODEL.md) · [Publication policy](docs/PUBLICATION_POLICY.md) · [Threat model](docs/THREAT_MODEL.md)
|
|
85
|
+
- [Development](docs/DEVELOPMENT.md) · [Plan](PLAN.md)
|
|
86
|
+
|
|
87
|
+
Apache-2.0 licensed.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: machinechecked
|
|
3
|
+
Version: 0.1.13
|
|
4
|
+
Summary: Read a mathematical paper beside its Lean formalisation, and see claim by claim what Lean establishes.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Project-URL: Homepage, https://machinechecked.org
|
|
7
|
+
Project-URL: Documentation, https://github.com/cgarryZA/MachineChecked/blob/main/docs/GETTING_STARTED.md
|
|
8
|
+
Project-URL: Source, https://github.com/cgarryZA/MachineChecked
|
|
9
|
+
Project-URL: Issues, https://github.com/cgarryZA/MachineChecked/issues
|
|
10
|
+
Keywords: lean,lean4,formal verification,formalization,mathematics,proof,theorem prover,mathlib,audit,latex
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: jsonschema>=4
|
|
20
|
+
Requires-Dist: pyyaml>=6
|
|
21
|
+
Provides-Extra: test
|
|
22
|
+
Requires-Dist: pytest>=7; extra == "test"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# MachineChecked
|
|
26
|
+
|
|
27
|
+
**Read a mathematical paper beside its Lean formalisation.**
|
|
28
|
+
|
|
29
|
+
Select a statement to inspect its Lean counterpart, proof results and correspondence reviews.
|
|
30
|
+
MachineChecked runs locally in your Lean project and saves the links you choose.
|
|
31
|
+
|
|
32
|
+
[Try the demo](https://machinechecked.org/demo/) · [Browse papers](https://machinechecked.org/papers/) · [Setup guide](docs/GETTING_STARTED.md)
|
|
33
|
+
|
|
34
|
+
## Open your paper
|
|
35
|
+
|
|
36
|
+
From your Lean project's directory:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
lake build
|
|
40
|
+
uvx machinechecked view
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
MachineChecked finds the paper and opens the reader. You can also name a LaTeX file, PDF or URL:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
uvx machinechecked view paper/main.tex
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Requires Python 3.11+, your project's Lean toolchain, and TeX Live for LaTeX or Poppler for PDFs.
|
|
50
|
+
The web reader is included. For a persistent command, run `uv tool install machinechecked`;
|
|
51
|
+
then use `machinechecked` directly.
|
|
52
|
+
|
|
53
|
+
Select a claim from the contents or paper margin. **Expand comparison** shows the paper,
|
|
54
|
+
complete readable statement and exact Lean together. Follow existing `\lean{...}` tags, confirm a
|
|
55
|
+
suggestion, or choose a declaration. The reader saves your choices in `machinechecked.links.json`.
|
|
56
|
+
Projects with a `formalization.yaml` supply their paper sources and declared links automatically.
|
|
57
|
+
|
|
58
|
+
## Read the evidence
|
|
59
|
+
|
|
60
|
+
A Lean proof establishes a formal proposition. A correspondence review compares that proposition
|
|
61
|
+
and its definitions with the paper. Source checks identify the audited text; independent kernel
|
|
62
|
+
replay checks the proof again. The reader shows each result and its provenance in **Audit details**.
|
|
63
|
+
|
|
64
|
+
The optional **Review** view guides you through three steps:
|
|
65
|
+
|
|
66
|
+
1. Read the paper and record your interpretation.
|
|
67
|
+
2. Compare the Lean statement's assumptions and conclusion; record a verdict.
|
|
68
|
+
3. Read the author's review, save your report in the browser, and export it.
|
|
69
|
+
|
|
70
|
+
The maintainer evaluates reports and promotes reviews into the project's acceptance records.
|
|
71
|
+
[Review guide →](docs/REVIEWING.md)
|
|
72
|
+
|
|
73
|
+
## Share the reader
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
uvx machinechecked build # .machinechecked/MachineChecked.html
|
|
77
|
+
uvx machinechecked build --site public/ # a static site with audit.json
|
|
78
|
+
uvx machinechecked check # check linked declarations for automation
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The HTML file opens directly in a browser. It includes the paper, Lean statements and audit data;
|
|
82
|
+
review those contents before publishing. Host the site directory on GitHub Pages or another static
|
|
83
|
+
host. Published audits carry their author's name, project commit and paper revision.
|
|
84
|
+
|
|
85
|
+
**Copy link** shares a claim. **Report issue** opens a draft in the audit's GitHub repository,
|
|
86
|
+
with the claim identifier, declarations and commits filled in. Set that repository with
|
|
87
|
+
`--issues owner/repo`.
|
|
88
|
+
|
|
89
|
+
## With a coding agent
|
|
90
|
+
|
|
91
|
+
`machinechecked check --json` prints structured results for scripts and agents. The
|
|
92
|
+
[MachineChecked skill](skills/machinechecked/SKILL.md) covers commands, status codes and evidence.
|
|
93
|
+
[Agent guide →](docs/AGENTS.md)
|
|
94
|
+
|
|
95
|
+
## Full assessment
|
|
96
|
+
|
|
97
|
+
Projects with locked specifications, a claim inventory and review records can configure
|
|
98
|
+
`machinechecked.toml`. Full assessment adds exact-type checks, definition-dependent reviews,
|
|
99
|
+
witnesses, refutations and independent kernel replay.
|
|
100
|
+
[Configuration guide →](docs/ASSURANCE.md)
|
|
101
|
+
|
|
102
|
+
## Documentation
|
|
103
|
+
|
|
104
|
+
- [Get started](docs/GETTING_STARTED.md) — install, open, link, share and troubleshoot
|
|
105
|
+
- [Reviewing](docs/REVIEWING.md) — record mathematical judgements
|
|
106
|
+
- [Full assessment](docs/ASSURANCE.md) — configuration and acceptance
|
|
107
|
+
- [Evidence policy](docs/EVIDENCE_POLICY.md) — what each check establishes
|
|
108
|
+
- [Data model](docs/DATA_MODEL.md) · [Publication policy](docs/PUBLICATION_POLICY.md) · [Threat model](docs/THREAT_MODEL.md)
|
|
109
|
+
- [Development](docs/DEVELOPMENT.md) · [Plan](PLAN.md)
|
|
110
|
+
|
|
111
|
+
Apache-2.0 licensed.
|
{machinechecked-0.1.11 → machinechecked-0.1.13}/engine/python/machinechecked.egg-info/SOURCES.txt
RENAMED
|
@@ -25,6 +25,7 @@ engine/python/prooflens/pdfclaims.py
|
|
|
25
25
|
engine/python/prooflens/pipeline.py
|
|
26
26
|
engine/python/prooflens/probe.py
|
|
27
27
|
engine/python/prooflens/promote.py
|
|
28
|
+
engine/python/prooflens/published.py
|
|
28
29
|
engine/python/prooflens/replay.py
|
|
29
30
|
engine/python/prooflens/review_cli.py
|
|
30
31
|
engine/python/prooflens/review_queue.py
|
|
@@ -32,12 +33,15 @@ engine/python/prooflens/reviews.py
|
|
|
32
33
|
engine/python/prooflens/schemas.py
|
|
33
34
|
engine/python/prooflens/server.py
|
|
34
35
|
engine/python/prooflens/simple.py
|
|
36
|
+
engine/python/prooflens/source_regions.py
|
|
35
37
|
engine/python/prooflens/sources.py
|
|
38
|
+
engine/python/prooflens/status.py
|
|
36
39
|
engine/python/prooflens/symbols.py
|
|
37
40
|
engine/python/prooflens/tex.py
|
|
38
41
|
engine/python/prooflens/util.py
|
|
39
42
|
engine/python/prooflens/data/ProofLensProbe.lean
|
|
40
43
|
engine/python/prooflens/data/prooflens.sty
|
|
44
|
+
engine/python/prooflens/data/statuses.json
|
|
41
45
|
engine/python/prooflens/data/schema/evidence.schema.json
|
|
42
46
|
engine/python/prooflens/data/schema/inventory.schema.json
|
|
43
47
|
engine/python/prooflens/data/schema/manifest-claim.schema.json
|
|
@@ -63,6 +67,7 @@ engine/python/prooflens/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2
|
|
|
63
67
|
engine/python/prooflens/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2
|
|
64
68
|
engine/python/prooflens/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2
|
|
65
69
|
engine/python/prooflens/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2
|
|
66
|
-
engine/python/prooflens/web/assets/
|
|
67
|
-
engine/python/prooflens/web/assets/index-
|
|
70
|
+
engine/python/prooflens/web/assets/cursor-editorTextHighlight-kG3uUOwL.svg
|
|
71
|
+
engine/python/prooflens/web/assets/index-DevCW_Pm.js
|
|
72
|
+
engine/python/prooflens/web/assets/index-GfZV3aEH.css
|
|
68
73
|
engine/python/prooflens/web/assets/pdf.worker.min-yatZIOMy.mjs
|
|
@@ -22,7 +22,10 @@ valid, and a Comparator replay of every proof).
|
|
|
22
22
|
|
|
23
23
|
from __future__ import annotations
|
|
24
24
|
|
|
25
|
+
from .status import fields
|
|
26
|
+
|
|
25
27
|
from .reviews import Review, history
|
|
28
|
+
from .source_regions import SCHEME as SOURCE_SCHEME, matches as source_matches
|
|
26
29
|
|
|
27
30
|
OUT_OF_SCOPE = {"expository", "literature", "empirical", "proof-step", "part-of", "duplicate"}
|
|
28
31
|
|
|
@@ -303,44 +306,48 @@ class Assessor:
|
|
|
303
306
|
# -- claims ---------------------------------------------------------------------------
|
|
304
307
|
|
|
305
308
|
@staticmethod
|
|
306
|
-
def
|
|
309
|
+
def claim_code(claim: dict, clauses: list[dict]) -> str:
|
|
307
310
|
"""The status of a claim from its clauses: a refuted original clause never hides another
|
|
308
311
|
original clause."""
|
|
309
312
|
scope = claim["scope"]
|
|
310
313
|
if scope in OUT_OF_SCOPE:
|
|
311
|
-
return "
|
|
314
|
+
return "scope." + scope
|
|
312
315
|
if any(c["state"] == "unchecked" for c in clauses):
|
|
313
|
-
return ("definition" if scope == "definition" else "formal") + "
|
|
316
|
+
return ("definition" if scope == "definition" else "formal") + ".unchecked"
|
|
314
317
|
if scope == "definition":
|
|
315
318
|
if not clauses:
|
|
316
|
-
return "definition
|
|
319
|
+
return "definition.unstated"
|
|
317
320
|
if not all(c["review"] in ("reviewed", "author-reviewed") for c in clauses):
|
|
318
|
-
return "definition
|
|
319
|
-
return ("definition
|
|
321
|
+
return "definition.review-pending"
|
|
322
|
+
return ("definition.author-reviewed"
|
|
320
323
|
if any(c["review"] == "author-reviewed" for c in clauses)
|
|
321
|
-
else "definition
|
|
324
|
+
else "definition.reviewed")
|
|
322
325
|
if not clauses:
|
|
323
|
-
return "formal
|
|
326
|
+
return "formal.unspecified"
|
|
324
327
|
originals = [c for c in clauses if not c.get("corrects")]
|
|
325
328
|
if not originals:
|
|
326
|
-
return "formal
|
|
329
|
+
return "formal.malformed"
|
|
327
330
|
refuted = [c for c in originals if c.get("refute_ok")]
|
|
328
331
|
rest = [c for c in originals if not c.get("refute_ok")]
|
|
329
332
|
rest_proved = all(c.get("accept_ok") for c in rest)
|
|
330
333
|
if refuted:
|
|
331
334
|
fixed = all(any(k.get("accept_ok") for k in clauses if k.get("corrects") == c["name"])
|
|
332
335
|
for c in refuted)
|
|
333
|
-
return ("refuted
|
|
334
|
-
+ ("" if rest_proved else "
|
|
336
|
+
return ("formal.refuted" + (".corrected" if fixed else "")
|
|
337
|
+
+ ("" if rest_proved else ".open"))
|
|
335
338
|
if rest_proved:
|
|
336
339
|
if not all(c["review"] in ("reviewed", "author-reviewed") for c in rest):
|
|
337
|
-
return "formal
|
|
338
|
-
return ("formal
|
|
340
|
+
return "formal.review-pending"
|
|
341
|
+
return ("formal.author-reviewed"
|
|
339
342
|
if any(c["review"] == "author-reviewed" for c in rest)
|
|
340
|
-
else "formal
|
|
341
|
-
return "formal
|
|
343
|
+
else "formal.accepted")
|
|
344
|
+
return "formal.open"
|
|
345
|
+
|
|
346
|
+
@staticmethod
|
|
347
|
+
def claim_status(claim: dict, clauses: list[dict]) -> str:
|
|
348
|
+
return fields(Assessor.claim_code(claim, clauses))["status"]
|
|
342
349
|
|
|
343
|
-
def blockers(self, claim: dict,
|
|
350
|
+
def blockers(self, claim: dict, clauses: list[dict]) -> list[str]:
|
|
344
351
|
"""Why the claim is not accepted, in plain words, most basic first: one line per reason,
|
|
345
352
|
saying which clauses it affects. Empty for an accepted claim whose proofs were replayed,
|
|
346
353
|
and for a claim out of scope."""
|
|
@@ -388,7 +395,7 @@ class Assessor:
|
|
|
388
395
|
add("a regime the paper intends is not shown to be covered", c)
|
|
389
396
|
rp = c["checks"].get("replay")
|
|
390
397
|
if rp and rp["state"] != "pass" and st in ("proved", "refuted"):
|
|
391
|
-
add("
|
|
398
|
+
add("Independent replay: not recorded (" + rp["detail"] + ")", c)
|
|
392
399
|
for reason, names in reasons.items():
|
|
393
400
|
if n == 1:
|
|
394
401
|
out.append(reason)
|
|
@@ -407,7 +414,7 @@ class Assessor:
|
|
|
407
414
|
if counts.get(state):
|
|
408
415
|
out.append(f"{counts[state]} definition{'s' if counts[state] > 1 else ''} its "
|
|
409
416
|
f"meaning depends on {words}")
|
|
410
|
-
if
|
|
417
|
+
if claim["scope"] == "definition" and self.claim_code(claim, clauses) != "definition.reviewed" and not out:
|
|
411
418
|
out.append("its definitions are not independently reviewed")
|
|
412
419
|
return list(dict.fromkeys(out))
|
|
413
420
|
|
|
@@ -415,9 +422,9 @@ class Assessor:
|
|
|
415
422
|
claims = []
|
|
416
423
|
for c in self.inv["claims"]:
|
|
417
424
|
clauses = [self.clause(c, cl, k) for k, cl in enumerate(c.get("clauses", []))]
|
|
418
|
-
|
|
419
|
-
claims.append({"id": c["id"],
|
|
420
|
-
"blockers": self.blockers(c,
|
|
425
|
+
state = fields(self.claim_code(c, clauses))
|
|
426
|
+
claims.append({"id": c["id"], **state, "clauses": clauses,
|
|
427
|
+
"blockers": self.blockers(c, clauses)})
|
|
421
428
|
self.inventory_checks()
|
|
422
429
|
if self.lean:
|
|
423
430
|
for v in self.lean.get("layering", []):
|
|
@@ -459,10 +466,10 @@ class Assessor:
|
|
|
459
466
|
if e["scope"] in OUT_OF_SCOPE:
|
|
460
467
|
continue
|
|
461
468
|
if e["scope"] == "definition":
|
|
462
|
-
if r["
|
|
469
|
+
if r["status_code"] != "definition.reviewed":
|
|
463
470
|
reasons.append(f"{r['id']}: {r['status']}")
|
|
464
471
|
continue
|
|
465
|
-
if r["
|
|
472
|
+
if r["status_code"] != "formal.accepted":
|
|
466
473
|
reasons.append(f"{r['id']}: {r['status']}")
|
|
467
474
|
for c in r["clauses"]:
|
|
468
475
|
if c.get("refute_ok"):
|
|
@@ -476,8 +483,8 @@ class Assessor:
|
|
|
476
483
|
reasons.append("comparator: no successful kernel replay covering every proof "
|
|
477
484
|
"of the paper")
|
|
478
485
|
out[pid] = {"source": source,
|
|
479
|
-
**({"source_note": "
|
|
480
|
-
"
|
|
486
|
+
**({"source_note": "PDF source; statement positions are approximate. "
|
|
487
|
+
"Coverage is checked against detected headings, not guaranteed complete."} if source == "pdf" else {}),
|
|
481
488
|
"consistency": {"pass": not consistency, "failures": consistency},
|
|
482
489
|
"release": {"pass": not reasons, "reasons": reasons},
|
|
483
490
|
"comparator": comparator}
|
|
@@ -507,8 +514,18 @@ class Assessor:
|
|
|
507
514
|
# -- inventory against the compiled paper ---------------------------------------------
|
|
508
515
|
|
|
509
516
|
def inventory_checks(self):
|
|
510
|
-
"""
|
|
517
|
+
"""Check coverage against the detected paper statements, and LaTeX source pins."""
|
|
511
518
|
for pid, t in (self.tex or {}).items():
|
|
519
|
+
if t.get("mode") == "pdf":
|
|
520
|
+
claims = [c for c in self.inv["claims"] if c["paper"] == pid]
|
|
521
|
+
for anchor in t.get("anchors", []):
|
|
522
|
+
if not any(match_anchor(c, [anchor]) is not None for c in claims):
|
|
523
|
+
label = f"{anchor['env'].capitalize()} {anchor.get('number', '')}"
|
|
524
|
+
self.findings.append(_finding(
|
|
525
|
+
"violation", "inventory-gap",
|
|
526
|
+
f"{pid}:{anchor['env']}:{anchor.get('number', '')}:{anchor['id']}",
|
|
527
|
+
f"{label} is detected in the PDF but not in the inventory"))
|
|
528
|
+
continue
|
|
512
529
|
if t.get("mode") != "latex":
|
|
513
530
|
continue
|
|
514
531
|
anchors = t["anchors"]
|
|
@@ -516,15 +533,20 @@ class Assessor:
|
|
|
516
533
|
for c in [c for c in self.inv["claims"] if c["paper"] == pid]:
|
|
517
534
|
line = line_location(c)
|
|
518
535
|
if line is not None:
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
536
|
+
region = (t.get("regions") or {}).get(c["id"], {})
|
|
537
|
+
if c.get("source_hash_scheme") != SOURCE_SCHEME:
|
|
538
|
+
self.findings.append(_finding(
|
|
539
|
+
"violation", "source-hash-scheme", c["id"],
|
|
540
|
+
f"{c['location']}: source regions must be pinned at the original "
|
|
541
|
+
"revision (python -m prooflens.source_regions --config FILE "
|
|
542
|
+
f"--paper {pid}); then rebuild"))
|
|
543
|
+
elif not source_matches(c, t):
|
|
544
|
+
detail = region.get("error") or (
|
|
545
|
+
"is missing; rebuild the source evidence" if not region else
|
|
546
|
+
"differs from the frozen source region")
|
|
523
547
|
self.findings.append(_finding(
|
|
524
548
|
"violation", "source-changed", c["id"],
|
|
525
|
-
f"the source
|
|
526
|
-
+ ("is missing" if got is None else
|
|
527
|
-
"differs from the frozen inventory")))
|
|
549
|
+
f"the source region at {c['location']} {detail}"))
|
|
528
550
|
continue
|
|
529
551
|
a = match_anchor(c, anchors)
|
|
530
552
|
if a is None:
|
|
@@ -67,7 +67,7 @@ def descriptor(index: dict, lean_root: Path | None, author: str | None = None,
|
|
|
67
67
|
papers = []
|
|
68
68
|
for p in index.get("papers", []):
|
|
69
69
|
ax = arxiv_id(paper_url) if len(index.get("papers", [])) == 1 else None
|
|
70
|
-
entry = {"title": p.get("title"), "id": ax[0] if ax else None,
|
|
70
|
+
entry = {"key": p["id"], "title": p.get("title"), "id": ax[0] if ax else None,
|
|
71
71
|
"version": ax[1] if ax else None, "url": paper_url,
|
|
72
72
|
# A pinned revision, else the commit of the folder the paper was read from.
|
|
73
73
|
"revision": p.get("revision") or p.get("source_commit")}
|
|
@@ -184,25 +184,79 @@ def _pack(arc: Path, members: list[tuple[Path, str]]) -> None:
|
|
|
184
184
|
raise CacheError("zstd failed while writing the archive")
|
|
185
185
|
|
|
186
186
|
|
|
187
|
+
def _unpacked_size(members: list[tuple[Path, str]]) -> int:
|
|
188
|
+
"""The bytes of the files the archive holds, unpacked."""
|
|
189
|
+
total = 0
|
|
190
|
+
for src, _ in members:
|
|
191
|
+
for f in src.rglob("*"):
|
|
192
|
+
if f.is_file() and not f.is_symlink():
|
|
193
|
+
total += f.stat().st_size
|
|
194
|
+
return total
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def _gb(n: float) -> str:
|
|
198
|
+
return f"{n / 1e9:.1f} GB"
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def check_space(project: Path, tmp: Path, man: dict) -> None:
|
|
202
|
+
"""Refuse a restore that cannot fit, before anything is downloaded: the archive needs its
|
|
203
|
+
size in `tmp`, and its unpacked build (recorded by `save`; four times the archive for an
|
|
204
|
+
older manifest) next to the project."""
|
|
205
|
+
size = int(man.get("size") or 0)
|
|
206
|
+
unpacked = int(man.get("unpacked_size") or 4 * size)
|
|
207
|
+
lake = project / ".lake"
|
|
208
|
+
where = lake if lake.exists() else project
|
|
209
|
+
need = {where: unpacked}
|
|
210
|
+
if os.stat(tmp).st_dev == os.stat(where).st_dev:
|
|
211
|
+
need[where] += size
|
|
212
|
+
else:
|
|
213
|
+
need[tmp] = size
|
|
214
|
+
for path, n in need.items():
|
|
215
|
+
free = shutil.disk_usage(path).free
|
|
216
|
+
if free < n:
|
|
217
|
+
raise CacheError(
|
|
218
|
+
f"not enough disk space to restore: {_gb(n)} needed under {path}, {_gb(free)} "
|
|
219
|
+
"free. Free some space (for example a second copy of a dependency at the same "
|
|
220
|
+
"revision, or old build output) and restore again; nothing was changed")
|
|
221
|
+
|
|
222
|
+
|
|
187
223
|
def _unpack(arc: Path, project: Path) -> None:
|
|
188
224
|
"""Unpack an archive written by `_pack` into the project and its path dependencies, with the
|
|
189
|
-
tar `data` filter (no absolute paths, no `..`, no links out of the destination).
|
|
225
|
+
tar `data` filter (no absolute paths, no `..`, no links out of the destination). Everything
|
|
226
|
+
is unpacked into a staging folder first and moved into place only once the whole archive
|
|
227
|
+
has been read, so a failure (a full disk, a corrupt archive) leaves the build as it was."""
|
|
190
228
|
import tarfile
|
|
191
229
|
deps = {d.name: d for d in path_deps(project)}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
230
|
+
stage = Path(tempfile.mkdtemp(prefix=".lean-cache-restore-", dir=project))
|
|
231
|
+
try:
|
|
232
|
+
bases: dict[str, Path] = {}
|
|
233
|
+
z = subprocess.Popen(["zstd", "-d", "-q", "-c", str(arc)], stdout=subprocess.PIPE)
|
|
234
|
+
with tarfile.open(fileobj=z.stdout, mode="r|") as tf:
|
|
235
|
+
for m in tf:
|
|
236
|
+
head, _, rest = m.name.partition("/")
|
|
237
|
+
if head == "project" and rest:
|
|
238
|
+
key, base, m.name = "project", project, rest
|
|
239
|
+
elif head == "path" and rest.partition("/")[0] in deps:
|
|
240
|
+
name, _, m.name = rest.partition("/")
|
|
241
|
+
key, base = f"path-{name}", deps[name]
|
|
242
|
+
else:
|
|
243
|
+
raise CacheError(f"unexpected path in the archive: {m.name}")
|
|
244
|
+
bases[key] = base
|
|
245
|
+
tf.extract(m, stage / key, filter="data")
|
|
246
|
+
if z.wait() != 0:
|
|
247
|
+
raise CacheError("zstd failed while reading the archive")
|
|
248
|
+
for key, base in bases.items():
|
|
249
|
+
root = stage / key
|
|
250
|
+
for f in sorted(root.rglob("*")):
|
|
251
|
+
if f.is_dir() and not f.is_symlink():
|
|
252
|
+
continue
|
|
253
|
+
dest = base / f.relative_to(root)
|
|
254
|
+
dest.parent.mkdir(parents=True, exist_ok=True)
|
|
255
|
+
shutil.move(str(f), str(dest))
|
|
256
|
+
except OSError as e:
|
|
257
|
+
raise CacheError(f"the restore failed ({e}); the build was left as it was") from e
|
|
258
|
+
finally:
|
|
259
|
+
shutil.rmtree(stage, ignore_errors=True)
|
|
206
260
|
|
|
207
261
|
|
|
208
262
|
def repository(project: Path) -> str | None:
|
|
@@ -263,7 +317,8 @@ def save(project: Path, out: Path, targets: list[str], pin_file: str | None = No
|
|
|
263
317
|
manifest = {"commit": commit, "project": package_name(project), "layout": 2,
|
|
264
318
|
"inputs_digest": inputs_digest(project), "repository": repository(project),
|
|
265
319
|
"targets": targets or ["(default)"], "dirs": dirs, "sha256": digest,
|
|
266
|
-
"size": size, "
|
|
320
|
+
"size": size, "unpacked_size": _unpacked_size(_members(project)),
|
|
321
|
+
"parts": parts, "licence_files": licences,
|
|
267
322
|
"created": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
|
|
268
323
|
**fingerprint(project)}
|
|
269
324
|
(out / f"{name}.json").write_text(json.dumps(manifest, indent=1) + "\n")
|
|
@@ -403,6 +458,7 @@ def restore(project: Path, repo: str | None = None, local: Path | None = None,
|
|
|
403
458
|
if no_history else ""))
|
|
404
459
|
key, stem, man = best
|
|
405
460
|
dist = key[1]
|
|
461
|
+
check_space(project, tmp, man)
|
|
406
462
|
t0 = time.time()
|
|
407
463
|
arc = tmp / f"{stem}.tar.zst"
|
|
408
464
|
pieces = man["parts"] if man.get("parts") else [{"name": arc.name, "sha256": man["sha256"]}]
|