calkit-python 0.52.0__py3-none-any.whl → 0.52.2__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.
Files changed (81) hide show
  1. calkit/agent_skills/check-reproducibility/SKILL.md +5 -0
  2. calkit/agent_skills/connect-overleaf-project/SKILL.md +21 -8
  3. calkit/agent_skills/review-paper/SKILL.md +179 -0
  4. calkit/browser_link.py +1075 -86
  5. calkit/cli/check.py +57 -6
  6. calkit/cli/delete.py +20 -1
  7. calkit/cli/export.py +373 -4
  8. calkit/cli/latex.py +221 -13
  9. calkit/cli/list.py +25 -2
  10. calkit/cli/main/core.py +253 -39
  11. calkit/cli/main/xr.py +28 -430
  12. calkit/cli/new.py +122 -21
  13. calkit/cli/notebooks.py +126 -44
  14. calkit/cli/office.py +46 -0
  15. calkit/cli/update.py +5 -1
  16. calkit/core.py +186 -15
  17. calkit/docx.py +14 -0
  18. calkit/dvc/core.py +147 -9
  19. calkit/environments/core.py +233 -0
  20. calkit/environments/docker.py +1 -2
  21. calkit/environments/texlive.py +31 -3
  22. calkit/export.py +195 -7
  23. calkit/git.py +7 -2
  24. calkit/latex.py +4 -0
  25. calkit/models/core.py +35 -7
  26. calkit/models/io.py +11 -0
  27. calkit/models/pipeline.py +165 -18
  28. calkit/pipeline/__init__.py +3 -0
  29. calkit/{pipeline.py → pipeline/core.py} +303 -6
  30. calkit/pipeline/detect.py +724 -0
  31. calkit/pptx.py +346 -0
  32. calkit/provenance.py +648 -5
  33. calkit/releases.py +1 -1
  34. calkit/reproducibility.py +6 -0
  35. calkit/resources/__init__.py +144 -9
  36. calkit/resources/devcontainer/Dockerfile +9 -0
  37. calkit/reviews.py +363 -0
  38. calkit/tests/cli/main/test_core.py +368 -0
  39. calkit/tests/cli/test_check.py +65 -0
  40. calkit/tests/cli/test_export.py +187 -12
  41. calkit/tests/cli/test_latex.py +289 -6
  42. calkit/tests/cli/test_new.py +159 -3
  43. calkit/tests/cli/test_notebooks.py +94 -0
  44. calkit/tests/cli/test_office.py +63 -0
  45. calkit/tests/cli/test_update.py +29 -0
  46. calkit/tests/conftest.py +14 -2
  47. calkit/tests/dvc/test_core.py +91 -0
  48. calkit/tests/environments/test_core.py +118 -0
  49. calkit/tests/environments/test_texlive.py +6 -0
  50. calkit/tests/models/test_pipeline.py +104 -2
  51. calkit/tests/pipeline/__init__.py +0 -0
  52. calkit/tests/{test_pipeline.py → pipeline/test_core.py} +233 -7
  53. calkit/tests/pipeline/test_detect.py +189 -0
  54. calkit/tests/test_browser_link.py +624 -4
  55. calkit/tests/test_core.py +89 -0
  56. calkit/tests/test_docx.py +27 -3
  57. calkit/tests/test_export.py +88 -3
  58. calkit/tests/test_git.py +5 -0
  59. calkit/tests/test_pptx.py +243 -0
  60. calkit/tests/test_provenance.py +284 -0
  61. calkit/tests/test_reproducibility.py +21 -0
  62. calkit/tests/test_resources.py +194 -3
  63. calkit/tests/test_reviews.py +197 -0
  64. {calkit_python-0.52.0.dist-info → calkit_python-0.52.2.dist-info}/METADATA +1 -1
  65. {calkit_python-0.52.0.dist-info → calkit_python-0.52.2.dist-info}/RECORD +81 -71
  66. {calkit_python-0.52.0.data → calkit_python-0.52.2.data}/data/etc/jupyter/jupyter_server_config.d/calkit.json +0 -0
  67. {calkit_python-0.52.0.data → calkit_python-0.52.2.data}/data/share/jupyter/labextensions/calkit/package.json +0 -0
  68. {calkit_python-0.52.0.data → calkit_python-0.52.2.data}/data/share/jupyter/labextensions/calkit/schemas/calkit/package.json.orig +0 -0
  69. {calkit_python-0.52.0.data → calkit_python-0.52.2.data}/data/share/jupyter/labextensions/calkit/schemas/calkit/plugin.json +0 -0
  70. {calkit_python-0.52.0.data → calkit_python-0.52.2.data}/data/share/jupyter/labextensions/calkit/static/506.c34b070098184e33.js +0 -0
  71. {calkit_python-0.52.0.data → calkit_python-0.52.2.data}/data/share/jupyter/labextensions/calkit/static/57d13a7399cec3c5.png +0 -0
  72. {calkit_python-0.52.0.data → calkit_python-0.52.2.data}/data/share/jupyter/labextensions/calkit/static/616.528427eb54a4a0c0.js +0 -0
  73. {calkit_python-0.52.0.data → calkit_python-0.52.2.data}/data/share/jupyter/labextensions/calkit/static/740.6bf87276e9e5788a.js +0 -0
  74. {calkit_python-0.52.0.data → calkit_python-0.52.2.data}/data/share/jupyter/labextensions/calkit/static/899.f9b9f9bf705a6493.js +0 -0
  75. {calkit_python-0.52.0.data → calkit_python-0.52.2.data}/data/share/jupyter/labextensions/calkit/static/935.46ecc6bf99aa593a.js +0 -0
  76. {calkit_python-0.52.0.data → calkit_python-0.52.2.data}/data/share/jupyter/labextensions/calkit/static/remoteEntry.109a3a8379365e59.js +0 -0
  77. {calkit_python-0.52.0.data → calkit_python-0.52.2.data}/data/share/jupyter/labextensions/calkit/static/style.js +0 -0
  78. {calkit_python-0.52.0.data → calkit_python-0.52.2.data}/data/share/jupyter/labextensions/calkit/static/third-party-licenses.json +0 -0
  79. {calkit_python-0.52.0.dist-info → calkit_python-0.52.2.dist-info}/WHEEL +0 -0
  80. {calkit_python-0.52.0.dist-info → calkit_python-0.52.2.dist-info}/entry_points.txt +0 -0
  81. {calkit_python-0.52.0.dist-info → calkit_python-0.52.2.dist-info}/licenses/LICENSE +0 -0
@@ -61,6 +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
+ A line ending in a `% calkit: ignore` comment, optionally with a reason,
65
+ e.g., `% calkit: ignore, from the pump's datasheet`, is left out of both
66
+ checks, as it is by the Overleaf extension. Add one only for a number the
67
+ user confirms isn't this project's result.
68
+
64
69
  <!-- TODO: needs human review -->
65
70
 
66
71
  For a number that is this project's result, it must reach the page
@@ -121,11 +121,17 @@ datasets:
121
121
  A PNG or PDF can't be created by a person, since an app or script exports
122
122
  it. If no script makes it, ask the person what they made it in, copy that
123
123
  file into the project, e.g., `figures/src/setup.svg`, and add a stage that
124
- exports it. Inkscape SVGs and GIMP files are exported as the pipeline runs;
125
- anything else is a manual step, which asks the person to export it again
126
- when its file changes:
124
+ exports it. Inkscape SVGs, GIMP files, and PowerPoint slides are exported
125
+ as the pipeline runs, a slide cropped to what's drawn on it by the app its
126
+ environment provides, e.g., LibreOffice in Calkit's image, which also runs
127
+ on GitHub; anything else is a manual step, which asks the person to export it
128
+ again when its file changes:
127
129
 
128
130
  ```yaml
131
+ environments:
132
+ libreoffice:
133
+ kind: docker
134
+ image: ghcr.io/calkit/libreoffice:0.1.0
129
135
  pipeline:
130
136
  stages:
131
137
  export-setup:
@@ -134,15 +140,22 @@ pipeline:
134
140
  outputs:
135
141
  - paper/setup.png
136
142
  export-diagram:
143
+ kind: pptx-export
144
+ source_path: figures/src/diagram.pptx
145
+ environment: libreoffice
146
+ outputs:
147
+ - path: paper/diagram.pdf
148
+ slide: 2
149
+ export-photo:
137
150
  kind: manual-step
138
- message: In PowerPoint, export paper/diagram.png from slide 2
151
+ message: In Photoshop, export paper/photo.png
139
152
  open:
140
- app: PowerPoint
141
- path: figures/src/diagram.pptx
153
+ app: Photoshop
154
+ path: figures/src/photo.psd
142
155
  inputs:
143
- - figures/src/diagram.pptx
156
+ - figures/src/photo.psd
144
157
  outputs:
145
- - paper/diagram.png
158
+ - paper/photo.png
146
159
  ```
147
160
 
148
161
  ## 7. Run, save, and sync
@@ -0,0 +1,179 @@
1
+ ---
2
+ name: review-paper
3
+ description: Help peer review a manuscript in a Calkit project, checking its
4
+ references, trying to reproduce its results with a pipeline, explaining the
5
+ paper when asked, and filing the reviewer's comments into a review file to
6
+ paste into the journal's form, while leaving the judgment to the reviewer.
7
+ Use when the user invokes `/calkit:review-paper`, or asks for help
8
+ reviewing a paper, refereeing a manuscript, or checking whether a
9
+ submission's results reproduce.
10
+ ---
11
+
12
+ # Review a paper
13
+
14
+ A review project holds the reviewer's work on someone else's manuscript:
15
+ the PDF they were sent, a reference check, any attempt to reproduce the
16
+ results, and the review itself, a Markdown file of numbered comments. The
17
+ authors' material comes in read-only, and everything the reviewer makes is
18
+ kept apart from it.
19
+
20
+ ## Confidentiality comes first
21
+
22
+ A manuscript under review is confidential, and many journals and funders
23
+ forbid putting one into an AI tool. Before reading the manuscript, ask the
24
+ user whether the venue's reviewer guidelines allow it.
25
+
26
+ - If it isn't allowed, or the user doesn't know, don't read the manuscript
27
+ or the reports made from it, e.g., the reference check's, which quotes its
28
+ citations. Set up the project, then hand the user the commands below to
29
+ run themselves.
30
+ - Either way, keep everything in this project. Nothing from the manuscript
31
+ goes anywhere else: other projects, issues, test data, or anything public.
32
+ The project stays private (`calkit new project` makes a private one
33
+ unless given `--public`), and comments are written for the editor and
34
+ authors, not posted anywhere.
35
+
36
+ ## The reviewer does the thinking
37
+
38
+ The editor asked the user for their judgment of the paper, so the critical
39
+ reading is theirs. Help them understand the paper, and take the drudgery off
40
+ their hands, so they have more time for it, but don't do it for them.
41
+
42
+ Deterministic, done by Calkit, never by hand:
43
+
44
+ - whether each reference is real and matches the record its identifier
45
+ names: `calkit check refs`;
46
+ - running the authors' code, or a reimplementation, and recording its
47
+ outputs: `calkit run`;
48
+ - where a comment goes in the review file and how it's numbered:
49
+ `calkit new comment` on the PDF.
50
+
51
+ Understanding and drudgery, done by you:
52
+
53
+ - answering the user's questions about the paper, e.g., explaining a
54
+ method, a term, or an equation, finding where something is described, or
55
+ tracing where a number comes from, with the page it's on. Answer the
56
+ question asked rather than assessing the paper. Don't open with a summary
57
+ of it: the user's first reading should be their own;
58
+ - setting up and running the checks and the reproduction, and comparing
59
+ their outputs with what the paper reports;
60
+ - filing the comments the user decides on.
61
+
62
+ Judgment, left to the user:
63
+
64
+ - whether the methods are sound, the conclusions follow from the results,
65
+ and the work is new and significant;
66
+ - whether a reproduced number agrees with the paper, and within what
67
+ tolerance;
68
+ - which findings are worth a comment, and what each one says;
69
+ - the summary and the recommendation.
70
+
71
+ Report what the checks found as facts, e.g., "rerunning the authors' code
72
+ gives 3.4%, where the paper says within 2%", and let the user decide what
73
+ it means. Don't volunteer critiques of the paper. If the user asks you to
74
+ write the assessment, suggest they draft it first, and offer to check its
75
+ claims against the paper and the pipeline's outputs, or to tighten its
76
+ wording.
77
+
78
+ ## Procedure
79
+
80
+ 1. **Set up the project**, unless the user already has one:
81
+
82
+ ```sh
83
+ calkit new project reviews/<short-name> --title "Review of <title>"
84
+ ```
85
+
86
+ Put the manuscript at `paper/manuscript.pdf`, or wherever the user wants
87
+ it. Its first comment lists it under `publications` in `calkit.yaml`, with
88
+ its review file, `paper/review.md` beside it by default:
89
+
90
+ ```yaml
91
+ publications:
92
+ - path: paper/manuscript.pdf
93
+ kind: journal-article
94
+ reviews:
95
+ - path: paper/review.md
96
+ ```
97
+
98
+ 2. **Check the references:**
99
+
100
+ ```sh
101
+ calkit check refs paper/manuscript.pdf
102
+ ```
103
+
104
+ With no source to read, the check takes the reference list printed in
105
+ the PDF. Each finding prints the entry as it was read, so the user can
106
+ see it came from the PDF. What fails the check is decidable, so report
107
+ it as fact:
108
+
109
+ - `doi-not-registered`: the DOI doesn't exist. Say so, and give the
110
+ right one if the report found it.
111
+ - `mismatch`: the DOI names a different work than the entry describes.
112
+
113
+ `not-found` isn't evidence of anything on its own. Many venues aren't
114
+ indexed, and the report says when it's one of them. Mention it to the
115
+ user to check by hand, but don't put it in the review as a problem.
116
+
117
+ To keep the report as an output, add a stage:
118
+
119
+ ```yaml
120
+ pipeline:
121
+ stages:
122
+ check-references:
123
+ kind: references-check
124
+ target_path: paper/manuscript.pdf
125
+ ```
126
+
127
+ 3. **Try to reproduce the results.** Look in the manuscript's data and code
128
+ availability statement for a compendium: a repository, archive, or
129
+ Calkit project.
130
+
131
+ - **With one**, bring it in read-only under `authors/`, pinned to the
132
+ version the manuscript describes, e.g., as a Git submodule at a commit
133
+ or with `calkit import zenodo`. Never edit it. Anything needed to run
134
+ it, e.g., an environment or a patched path, is a stage or a file in
135
+ this project. Add stages that run the authors' code (see
136
+ `create-pipeline` and `add-pipeline-stage`). Then add a stage that
137
+ compares its outputs with the numbers and figures the paper reports,
138
+ writing the comparison to a results file, e.g.,
139
+ `results/reproduction.json`.
140
+ - **Without one**, the missing code or data is itself a finding, and
141
+ usually the first comment. If the data is public and a central result
142
+ can be recomputed from the methods as written, a small reimplementation
143
+ in a stage shows whether the description is enough to reproduce it.
144
+ Say plainly that it's a reimplementation.
145
+
146
+ Ask the user what tolerance counts as agreement before writing the
147
+ comparison. Run with `calkit run`. Never run a script by hand and copy a
148
+ number into a comment: a comment's evidence should be an output the
149
+ pipeline made. Record what didn't reproduce as carefully as what did.
150
+
151
+ 4. **File the comments the user decides on.** Go through the findings
152
+ with them, and add each one they want to raise, in their words or in
153
+ wording they've approved:
154
+
155
+ ```sh
156
+ calkit new comment paper/manuscript.pdf --section major --page 4 \
157
+ --line 212 --highlight "within 2%" \
158
+ -m "Rerunning the authors' code gives 3.4% (results/reproduction.json)."
159
+ calkit new comment paper/manuscript.pdf --section major \
160
+ -m "The data needed to reproduce the main results isn't available."
161
+ ```
162
+
163
+ `--page`, `--line` (the manuscript's printed line number, if it has
164
+ them), and `--highlight` (text quoted from that spot) are written into
165
+ the comment, so the authors can find it, and the VS Code PDF viewer
166
+ shows it there. A comment without them is general. `--section` (major
167
+ or minor, as the user decides) puts it under `## Major comments` or
168
+ `## Minor comments`, each numbered from 1. The summary and assessment
169
+ go above them, and are the user's to write. The user will add most of
170
+ their own comments straight from the PDF in VS Code.
171
+
172
+ 5. **Hand it over.** Tell the user what was checked, what reproduced, and
173
+ what didn't. Point them to the review file to finish and paste into the
174
+ journal's form.
175
+
176
+ ## Related
177
+
178
+ - `create-pipeline` and `add-pipeline-stage` for the reproduction stages.
179
+ - `check-reproducibility` is the same idea for the user's own project.