calkit-python 0.51.0__py3-none-any.whl → 0.52.0__py3-none-any.whl
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.
- calkit/agent_skills/add-pipeline-stage/SKILL.md +6 -0
- calkit/agent_skills/build-paper-pipeline/SKILL.md +40 -9
- calkit/agent_skills/check-reproducibility/SKILL.md +18 -18
- calkit/agent_skills/conventions/SKILL.md +31 -3
- calkit/agent_skills/create-pipeline/SKILL.md +15 -6
- calkit/browser_link.py +1897 -0
- calkit/cli/browser_link.py +85 -0
- calkit/cli/check.py +345 -21
- calkit/cli/core.py +2 -10
- calkit/cli/fix.py +2 -2
- calkit/cli/import_.py +1 -1
- calkit/cli/latex.py +229 -82
- calkit/cli/main/core.py +531 -24
- calkit/cli/new.py +121 -53
- calkit/cli/open_.py +128 -79
- calkit/cli/overleaf.py +52 -26
- calkit/cli/sync.py +1 -1
- calkit/cli/update.py +49 -32
- calkit/config.py +95 -3
- calkit/core.py +317 -15
- calkit/docker.py +24 -6
- calkit/dvc/core.py +571 -64
- calkit/environments/core.py +46 -7
- calkit/environments/texlive.py +1494 -0
- calkit/git.py +86 -10
- calkit/hub/core.py +11 -4
- calkit/hub/link.py +4 -0
- calkit/install.py +87 -17
- calkit/invenio.py +206 -3
- calkit/latex.py +215 -24
- calkit/models/core.py +40 -24
- calkit/models/io.py +133 -54
- calkit/models/iteration.py +216 -13
- calkit/models/pipeline.py +431 -34
- calkit/models/requirements.py +6 -3
- calkit/overleaf.py +89 -7
- calkit/pipeline.py +406 -28
- calkit/provenance.py +381 -51
- calkit/questions.py +2 -2
- calkit/references.py +2053 -0
- calkit/releases.py +100 -2
- calkit/reproducibility.py +138 -48
- calkit/tests/cli/main/test_core.py +620 -2
- calkit/tests/cli/main/test_xr.py +1 -0
- calkit/tests/cli/test_browser_link.py +39 -0
- calkit/tests/cli/test_check.py +330 -0
- calkit/tests/cli/test_fix.py +3 -1
- calkit/tests/cli/test_import.py +45 -8
- calkit/tests/cli/test_latex.py +251 -31
- calkit/tests/cli/test_new.py +159 -5
- calkit/tests/cli/test_notebooks.py +3 -2
- calkit/tests/cli/test_open.py +56 -0
- calkit/tests/cli/test_overleaf.py +45 -4
- calkit/tests/cli/test_update.py +73 -6
- calkit/tests/conftest.py +95 -0
- calkit/tests/dvc/test_core.py +295 -0
- calkit/tests/environments/test_core.py +24 -3
- calkit/tests/environments/test_texlive.py +551 -0
- calkit/tests/hub/test_link.py +7 -0
- calkit/tests/models/test_io.py +32 -1
- calkit/tests/models/test_iteration.py +113 -10
- calkit/tests/models/test_pipeline.py +328 -8
- calkit/tests/test_browser_link.py +1052 -0
- calkit/tests/test_conda.py +8 -8
- calkit/tests/test_config.py +35 -0
- calkit/tests/test_core.py +200 -0
- calkit/tests/test_docker.py +26 -0
- calkit/tests/test_git.py +62 -0
- calkit/tests/test_install.py +49 -0
- calkit/tests/test_invenio.py +160 -1
- calkit/tests/test_latex.py +120 -0
- calkit/tests/test_magics.py +1 -0
- calkit/tests/test_overleaf.py +109 -0
- calkit/tests/test_pipeline.py +471 -2
- calkit/tests/test_provenance.py +278 -12
- calkit/tests/test_references.py +1127 -0
- calkit/tests/test_releases.py +89 -0
- calkit/tests/test_reproducibility.py +110 -1
- calkit/tests/test_workspace.py +5 -0
- calkit/workspace.py +6 -3
- {calkit_python-0.51.0.dist-info → calkit_python-0.52.0.dist-info}/METADATA +14 -2
- {calkit_python-0.51.0.dist-info → calkit_python-0.52.0.dist-info}/RECORD +98 -89
- {calkit_python-0.51.0.data → calkit_python-0.52.0.data}/data/etc/jupyter/jupyter_server_config.d/calkit.json +0 -0
- {calkit_python-0.51.0.data → calkit_python-0.52.0.data}/data/share/jupyter/labextensions/calkit/package.json +0 -0
- {calkit_python-0.51.0.data → calkit_python-0.52.0.data}/data/share/jupyter/labextensions/calkit/schemas/calkit/package.json.orig +0 -0
- {calkit_python-0.51.0.data → calkit_python-0.52.0.data}/data/share/jupyter/labextensions/calkit/schemas/calkit/plugin.json +0 -0
- {calkit_python-0.51.0.data → calkit_python-0.52.0.data}/data/share/jupyter/labextensions/calkit/static/506.c34b070098184e33.js +0 -0
- {calkit_python-0.51.0.data → calkit_python-0.52.0.data}/data/share/jupyter/labextensions/calkit/static/57d13a7399cec3c5.png +0 -0
- {calkit_python-0.51.0.data → calkit_python-0.52.0.data}/data/share/jupyter/labextensions/calkit/static/616.528427eb54a4a0c0.js +0 -0
- {calkit_python-0.51.0.data → calkit_python-0.52.0.data}/data/share/jupyter/labextensions/calkit/static/740.6bf87276e9e5788a.js +0 -0
- {calkit_python-0.51.0.data → calkit_python-0.52.0.data}/data/share/jupyter/labextensions/calkit/static/899.f9b9f9bf705a6493.js +0 -0
- {calkit_python-0.51.0.data → calkit_python-0.52.0.data}/data/share/jupyter/labextensions/calkit/static/935.46ecc6bf99aa593a.js +0 -0
- {calkit_python-0.51.0.data → calkit_python-0.52.0.data}/data/share/jupyter/labextensions/calkit/static/remoteEntry.109a3a8379365e59.js +0 -0
- {calkit_python-0.51.0.data → calkit_python-0.52.0.data}/data/share/jupyter/labextensions/calkit/static/style.js +0 -0
- {calkit_python-0.51.0.data → calkit_python-0.52.0.data}/data/share/jupyter/labextensions/calkit/static/third-party-licenses.json +0 -0
- {calkit_python-0.51.0.dist-info → calkit_python-0.52.0.dist-info}/WHEEL +0 -0
- {calkit_python-0.51.0.dist-info → calkit_python-0.52.0.dist-info}/entry_points.txt +0 -0
- {calkit_python-0.51.0.dist-info → calkit_python-0.52.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -40,6 +40,12 @@ calkit xr scripts/new-stage.py \
|
|
|
40
40
|
After running, inspect the new stage in `calkit.yaml` to confirm I/O is
|
|
41
41
|
correct.
|
|
42
42
|
|
|
43
|
+
<!-- TODO: needs human review -->
|
|
44
|
+
|
|
45
|
+
For a `.tex` file in a project with no `texlive` environment, create one
|
|
46
|
+
with `calkit new texlive-env` first, so `xr` uses it. Older versions of
|
|
47
|
+
Calkit otherwise create a Docker one with Calkit's LaTeX image.
|
|
48
|
+
|
|
43
49
|
## Option B: Write the stage manually
|
|
44
50
|
|
|
45
51
|
Write YAML directly when the stage is a shell command, or when you need
|
|
@@ -6,7 +6,7 @@ description: Build the pipeline stages a manuscript's TODO comments ask for,
|
|
|
6
6
|
invokes `/calkit:build-paper-pipeline`, leaves TODO comments in a manuscript
|
|
7
7
|
for an agent to address, or asks to work backwards from the writing to the
|
|
8
8
|
project behind it. Only for TODOs in a manuscript, and only in a Calkit
|
|
9
|
-
project
|
|
9
|
+
project; not TODO comments in source code, not GitHub issues, not a task
|
|
10
10
|
list in someone's notes.
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -31,13 +31,17 @@ number into the sentence.
|
|
|
31
31
|
|
|
32
32
|
## The rule that makes this safe
|
|
33
33
|
|
|
34
|
+
<!-- TODO: needs human review -->
|
|
35
|
+
|
|
34
36
|
**Never type a computed value into the manuscript.** A number you typed is
|
|
35
37
|
a number nobody can check, and it goes stale the moment a stage reruns. The
|
|
36
38
|
number reaches the page through the pipeline: a stage computes it and
|
|
37
|
-
writes it to a results file,
|
|
38
|
-
LaTeX
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
writes it to a results file, and the manuscript, which loads the `calkit`
|
|
40
|
+
LaTeX package, reads it from that file with
|
|
41
|
+
`\ckvalue[.2f]{results/speedup.json}{mean_speedup}`. The same applies to
|
|
42
|
+
figures (`\ckfigure{...}`) and tables (`\cktable{...}`) over pipeline
|
|
43
|
+
outputs, and to the answers in `calkit.yaml` (`{name}` placeholders over
|
|
44
|
+
`value` evidence).
|
|
41
45
|
|
|
42
46
|
If you find yourself about to write `2.4x` into a `.tex` file, stop: that
|
|
43
47
|
is the hole, not the fix. The `check-reproducibility` skill covers finding
|
|
@@ -74,10 +78,37 @@ building a pipeline from scratch.
|
|
|
74
78
|
headlessly. Write the results to a JSON file under `results/` with keys
|
|
75
79
|
named the way the paper will refer to them.
|
|
76
80
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
<!-- TODO: needs human review -->
|
|
82
|
+
|
|
83
|
+
4. **Inject, don't copy.** Load the package with `\usepackage{calkit}` if
|
|
84
|
+
the document doesn't already, and replace the TODO with the sentence the
|
|
85
|
+
user wrote, now with `\ckvalue[format]{results/<file>.json}{<key>}` where
|
|
86
|
+
the hole was:
|
|
87
|
+
|
|
88
|
+
```latex
|
|
89
|
+
\usepackage{calkit}
|
|
90
|
+
...
|
|
91
|
+
Our method is faster than the baseline by
|
|
92
|
+
\ckvalue[.2f]{results/speedup.json}{mean_speedup}$\times$.
|
|
93
|
+
\ckfigure[width=0.7\linewidth]{figures/speedup-distribution.png}
|
|
94
|
+
\cktable{tables/speedup-by-case.tex}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Paths are relative to the project, not the document. The document's
|
|
98
|
+
LaTeX stage depends on everything it includes this way, so there's no
|
|
99
|
+
`json-to-latex` or `map-paths` stage to add, and nothing to list in its
|
|
100
|
+
`inputs`. Pick the format for how the paper should read, e.g., `.2f`
|
|
101
|
+
for two decimal places or `.3g` for three significant figures; keys
|
|
102
|
+
reach into nested values with dots, e.g., `fit.slope`. `\ckvalue` can't
|
|
103
|
+
go inside siunitx commands, so write a unit after it, e.g.,
|
|
104
|
+
`\ckvalue[.1f]{results/flow.json}{speed}~\unit{\metre\per\second}`.
|
|
105
|
+
If the document already uses commands a `json-to-latex` stage
|
|
106
|
+
generates, they keep working; use `\ckvalue` for new values, and ask
|
|
107
|
+
before converting the old ones.
|
|
108
|
+
|
|
109
|
+
If no LaTeX stage builds the document yet, add one in a `texlive`
|
|
110
|
+
environment, which needs no Docker: `calkit new texlive-env`, if the
|
|
111
|
+
project has none, then `calkit xr paper/main.tex`.
|
|
81
112
|
|
|
82
113
|
5. **Make the question match the paper.** A claim in the paper is an answer
|
|
83
114
|
to a question. Add or update the entry under `questions` in
|
|
@@ -49,7 +49,7 @@ Judgment, done here:
|
|
|
49
49
|
3. **Every `retyped_values` finding is worth fixing.** Each is a number
|
|
50
50
|
the pipeline already computes, typed into the document: right today and
|
|
51
51
|
wrong the next time that stage runs. The finding names the results file
|
|
52
|
-
and key, so the fix is mechanical
|
|
52
|
+
and key, so the fix is mechanical: `\ckvalue{<file>}{<key>}`.
|
|
53
53
|
|
|
54
54
|
4. **`unattributed_numbers` is a list to read, not a list to fix.** Most
|
|
55
55
|
numbers in a paper are not results. A quantity quoted from a reference
|
|
@@ -61,8 +61,11 @@ Judgment, done here:
|
|
|
61
61
|
rewrite a sentence to make a check pass, and never invent a stage to
|
|
62
62
|
compute a number somebody else measured.
|
|
63
63
|
|
|
64
|
+
<!-- TODO: needs human review -->
|
|
65
|
+
|
|
64
66
|
For a number that is this project's result, it must reach the page
|
|
65
|
-
through the pipeline rather than through the author's fingers
|
|
67
|
+
through the pipeline rather than through the author's fingers. A stage
|
|
68
|
+
writes it to a results file:
|
|
66
69
|
|
|
67
70
|
```yaml
|
|
68
71
|
pipeline:
|
|
@@ -72,29 +75,26 @@ Judgment, done here:
|
|
|
72
75
|
environment: py
|
|
73
76
|
script_path: scripts/compute-drag.py
|
|
74
77
|
outputs: [results/drag.json]
|
|
75
|
-
drag-to-latex:
|
|
76
|
-
kind: json-to-latex
|
|
77
|
-
command_name: result
|
|
78
|
-
inputs: [results/drag.json]
|
|
79
|
-
outputs:
|
|
80
|
-
- path: paper/generated-drag.tex
|
|
81
|
-
storage: git
|
|
82
78
|
```
|
|
83
79
|
|
|
84
|
-
The script writes `{"DragCoefficient": 0.42}`. The document
|
|
85
|
-
|
|
80
|
+
The script writes `{"DragCoefficient": 0.42}`. The document loads the
|
|
81
|
+
`calkit` LaTeX package and reads the value from that file by its path
|
|
82
|
+
in the project and its key:
|
|
86
83
|
|
|
87
84
|
```latex
|
|
88
|
-
\
|
|
85
|
+
\usepackage{calkit}
|
|
89
86
|
...
|
|
90
|
-
The drag coefficient is \
|
|
87
|
+
The drag coefficient is \ckvalue[.2f]{results/drag.json}{DragCoefficient}.
|
|
91
88
|
```
|
|
92
89
|
|
|
93
|
-
|
|
94
|
-
`
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
The document's LaTeX stage depends on what it includes this way, so no
|
|
91
|
+
`json-to-latex` stage or added `inputs` are needed. A `retyped_values`
|
|
92
|
+
finding's `source` names the file and key to use. If the document
|
|
93
|
+
already uses commands a `json-to-latex` stage generates, e.g.,
|
|
94
|
+
`\result[DragCoefficient]`, they keep working, so referencing the
|
|
95
|
+
existing command is fine there too. Never define a macro that holds the
|
|
96
|
+
number, or edit a generated file by hand: either one is a typed value
|
|
97
|
+
with extra steps.
|
|
98
98
|
|
|
99
99
|
5. **Run the pipeline** (`calkit run`) and check again. Do not run the
|
|
100
100
|
script yourself and paste the number in: that is the failure this whole
|
|
@@ -66,6 +66,7 @@ kinds:
|
|
|
66
66
|
| `conda` | `environment.yml` |
|
|
67
67
|
| `pixi` | `pixi.toml` |
|
|
68
68
|
| `docker` | (image name, no local spec file needed) |
|
|
69
|
+
| `texlive` | (TeX Live packages, listed in the env) |
|
|
69
70
|
| `renv` | `renv.lock` |
|
|
70
71
|
| `julia` | `Project.toml` |
|
|
71
72
|
| `matlab` | (no spec file) |
|
|
@@ -78,6 +79,12 @@ For Python, default to a `uv` project environment, created with
|
|
|
78
79
|
`requires-python`. Use `uv-venv` only for a project that already has a
|
|
79
80
|
`requirements.txt` it should keep.
|
|
80
81
|
|
|
82
|
+
<!-- TODO: needs human review -->
|
|
83
|
+
|
|
84
|
+
For LaTeX, default to a `texlive` environment, created with
|
|
85
|
+
`calkit new texlive-env`, which needs no Docker. A build adds the packages
|
|
86
|
+
a document needs to the environment's lock.
|
|
87
|
+
|
|
81
88
|
Example environment definitions:
|
|
82
89
|
|
|
83
90
|
```yaml
|
|
@@ -86,9 +93,9 @@ environments:
|
|
|
86
93
|
kind: uv
|
|
87
94
|
path: pyproject.toml
|
|
88
95
|
|
|
89
|
-
|
|
90
|
-
kind:
|
|
91
|
-
|
|
96
|
+
tex:
|
|
97
|
+
kind: texlive
|
|
98
|
+
release: 2025
|
|
92
99
|
|
|
93
100
|
r-env:
|
|
94
101
|
kind: renv
|
|
@@ -123,6 +130,24 @@ See the `calkit.yaml` schema for details.
|
|
|
123
130
|
The most common stage kinds are `python-script`, `shell-script`, `shell-command`,
|
|
124
131
|
`jupyter-notebook`.
|
|
125
132
|
|
|
133
|
+
<!-- TODO: needs human review -->
|
|
134
|
+
|
|
135
|
+
### LaTeX documents
|
|
136
|
+
|
|
137
|
+
A document built by a `latex` stage includes pipeline outputs by their
|
|
138
|
+
path in the project with the `calkit` package:
|
|
139
|
+
|
|
140
|
+
```latex
|
|
141
|
+
\usepackage{calkit}
|
|
142
|
+
...
|
|
143
|
+
The error falls to \ckvalue[.2f]{results/metrics.json}{rmse}.
|
|
144
|
+
\ckfigure[width=0.7\linewidth]{figures/plot.png}
|
|
145
|
+
\cktable{tables/summary.tex}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The stage depends on everything included this way, so don't add
|
|
149
|
+
`json-to-latex` or `map-paths` stages, or list those files in `inputs`.
|
|
150
|
+
|
|
126
151
|
### Outputs: Git vs. DVC storage
|
|
127
152
|
|
|
128
153
|
By default, outputs are stored with DVC (large file storage). Use
|
|
@@ -136,6 +161,9 @@ outputs:
|
|
|
136
161
|
- path: results/summary.txt
|
|
137
162
|
storage: git
|
|
138
163
|
delete_before_run: false # don't delete before re-running
|
|
164
|
+
- path: results/runs
|
|
165
|
+
storage: git
|
|
166
|
+
ignore: ["*.log"] # neither stored nor part of the output
|
|
139
167
|
```
|
|
140
168
|
|
|
141
169
|
### Declaring dependencies between stages
|
|
@@ -50,7 +50,8 @@ Every stage must reference a named environment. Identify what's needed:
|
|
|
50
50
|
keep → `uv-venv`; `environment.yml` → `conda`
|
|
51
51
|
- **R**: `renv.lock` → `renv`
|
|
52
52
|
- **Julia**: `Project.toml` → `julia`
|
|
53
|
-
- **LaTeX**: `
|
|
53
|
+
- **LaTeX**: `texlive`, created with `calkit new texlive-env`, which
|
|
54
|
+
needs no Docker
|
|
54
55
|
- **MATLAB**: `matlab`
|
|
55
56
|
|
|
56
57
|
Add environments to `calkit.yaml`:
|
|
@@ -85,6 +86,12 @@ calkit xr scripts/train.py \
|
|
|
85
86
|
--output models/model.pkl
|
|
86
87
|
```
|
|
87
88
|
|
|
89
|
+
<!-- TODO: needs human review -->
|
|
90
|
+
|
|
91
|
+
Create the `texlive` environment before running `xr` on a `.tex` file, so
|
|
92
|
+
`xr` uses it. Older versions of Calkit otherwise create a Docker one with
|
|
93
|
+
Calkit's LaTeX image.
|
|
94
|
+
|
|
88
95
|
`xr` is not magic—sometimes it won't get everything right. But it handles
|
|
89
96
|
most of the boilerplate, so you can focus on verifying correctness and filling
|
|
90
97
|
in gaps. Scan through scripts for missing inputs, outputs, environment
|
|
@@ -120,13 +127,15 @@ pipeline:
|
|
|
120
127
|
build-paper:
|
|
121
128
|
kind: latex
|
|
122
129
|
target_path: paper/paper.tex
|
|
123
|
-
environment:
|
|
124
|
-
inputs:
|
|
125
|
-
- figures/fig1.png
|
|
126
|
-
- references.bib
|
|
127
|
-
outputs: []
|
|
130
|
+
environment: tex
|
|
128
131
|
```
|
|
129
132
|
|
|
133
|
+
<!-- TODO: needs human review -->
|
|
134
|
+
|
|
135
|
+
The paper includes `figures/fig1.png` with `\ckfigure{figures/fig1.png}`
|
|
136
|
+
and numbers with `\ckvalue`, from the `calkit` LaTeX package (see the
|
|
137
|
+
`conventions` skill), so the stage depends on them without listing them.
|
|
138
|
+
|
|
130
139
|
Rules:
|
|
131
140
|
|
|
132
141
|
- Stage names should be short, lowercase, hyphenated.
|