calkit-python 0.50.4__py3-none-any.whl → 0.50.5__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/connect-overleaf-project/SKILL.md +165 -0
- calkit/cli/main/core.py +12 -1
- calkit/cli/scheduler.py +51 -5
- calkit/latex.py +80 -36
- calkit/models/pipeline.py +37 -5
- calkit/overleaf.py +22 -0
- calkit/pipeline.py +9 -0
- calkit/tests/cli/test_scheduler.py +73 -0
- calkit/tests/test_overleaf.py +16 -0
- calkit/tests/test_pipeline.py +86 -4
- {calkit_python-0.50.4.dist-info → calkit_python-0.50.5.dist-info}/METADATA +1 -1
- {calkit_python-0.50.4.dist-info → calkit_python-0.50.5.dist-info}/RECORD +28 -27
- {calkit_python-0.50.4.data → calkit_python-0.50.5.data}/data/etc/jupyter/jupyter_server_config.d/calkit.json +0 -0
- {calkit_python-0.50.4.data → calkit_python-0.50.5.data}/data/share/jupyter/labextensions/calkit/package.json +0 -0
- {calkit_python-0.50.4.data → calkit_python-0.50.5.data}/data/share/jupyter/labextensions/calkit/schemas/calkit/package.json.orig +0 -0
- {calkit_python-0.50.4.data → calkit_python-0.50.5.data}/data/share/jupyter/labextensions/calkit/schemas/calkit/plugin.json +0 -0
- {calkit_python-0.50.4.data → calkit_python-0.50.5.data}/data/share/jupyter/labextensions/calkit/static/506.c34b070098184e33.js +0 -0
- {calkit_python-0.50.4.data → calkit_python-0.50.5.data}/data/share/jupyter/labextensions/calkit/static/57d13a7399cec3c5.png +0 -0
- {calkit_python-0.50.4.data → calkit_python-0.50.5.data}/data/share/jupyter/labextensions/calkit/static/616.528427eb54a4a0c0.js +0 -0
- {calkit_python-0.50.4.data → calkit_python-0.50.5.data}/data/share/jupyter/labextensions/calkit/static/740.6bf87276e9e5788a.js +0 -0
- {calkit_python-0.50.4.data → calkit_python-0.50.5.data}/data/share/jupyter/labextensions/calkit/static/899.f9b9f9bf705a6493.js +0 -0
- {calkit_python-0.50.4.data → calkit_python-0.50.5.data}/data/share/jupyter/labextensions/calkit/static/935.46ecc6bf99aa593a.js +0 -0
- {calkit_python-0.50.4.data → calkit_python-0.50.5.data}/data/share/jupyter/labextensions/calkit/static/remoteEntry.109a3a8379365e59.js +0 -0
- {calkit_python-0.50.4.data → calkit_python-0.50.5.data}/data/share/jupyter/labextensions/calkit/static/style.js +0 -0
- {calkit_python-0.50.4.data → calkit_python-0.50.5.data}/data/share/jupyter/labextensions/calkit/static/third-party-licenses.json +0 -0
- {calkit_python-0.50.4.dist-info → calkit_python-0.50.5.dist-info}/WHEEL +0 -0
- {calkit_python-0.50.4.dist-info → calkit_python-0.50.5.dist-info}/entry_points.txt +0 -0
- {calkit_python-0.50.4.dist-info → calkit_python-0.50.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: connect-overleaf-project
|
|
3
|
+
description: Connect an Overleaf project, e.g., a paper, thesis, or poster,
|
|
4
|
+
to a Calkit project and the scripts and data behind it, so its figures and
|
|
5
|
+
numbers come from a pipeline. Use when the user invokes
|
|
6
|
+
`/calkit:connect-overleaf-project`, asks to connect an Overleaf project
|
|
7
|
+
(often one open in their browser) to Calkit, or asks to make an Overleaf
|
|
8
|
+
document reproducible. Not for only signing in to Overleaf.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Connect an Overleaf project to its analysis
|
|
12
|
+
|
|
13
|
+
The person writes in Overleaf, e.g., a paper, thesis, or poster, and their
|
|
14
|
+
scripts and data are somewhere on their machine or a shared drive. The job is
|
|
15
|
+
to connect the two: a Calkit project with the document in it, stages that make
|
|
16
|
+
what the document shows, and the document reading those outputs instead of
|
|
17
|
+
pasted copies. The writing stays theirs. Change only how the document includes
|
|
18
|
+
figures and numbers.
|
|
19
|
+
|
|
20
|
+
Work in two places:
|
|
21
|
+
|
|
22
|
+
- **The browser**, through the person's own Overleaf session, for what only
|
|
23
|
+
it can do: connecting the document, and checking the result in the editor.
|
|
24
|
+
This needs a browser tool, e.g., Claude in Chrome.
|
|
25
|
+
- **A local clone**, through the CLI, for everything else.
|
|
26
|
+
|
|
27
|
+
Never type passwords or tokens. If something asks the person to sign in,
|
|
28
|
+
stop and ask them to do it.
|
|
29
|
+
|
|
30
|
+
## 1. Connect the document
|
|
31
|
+
|
|
32
|
+
In the Overleaf tab, open the Calkit panel from the launcher at the bottom
|
|
33
|
+
right, which reads "Calkit: not linked" when the document isn't connected. It's
|
|
34
|
+
in a shadow root, so it may not show in the page's accessibility tree; take a
|
|
35
|
+
screenshot to find it.
|
|
36
|
+
|
|
37
|
+
Click "Make this paper reproducible", check the project name, privacy, and
|
|
38
|
+
folder, and create the project. Name the folder for what the document is,
|
|
39
|
+
e.g., `paper` only for a paper, and `thesis` for a thesis. A project with
|
|
40
|
+
several publications may keep them under `pubs`, e.g., `pubs/paper-1` and
|
|
41
|
+
`pubs/thesis`, and presentations under `presentations`. The panel then
|
|
42
|
+
shows the project and "in sync". If the document should go in a project the
|
|
43
|
+
person already has, use "Use a project I already have" instead.
|
|
44
|
+
|
|
45
|
+
Without the browser extension, `calkit overleaf import URL SUBFOLDER` adds the
|
|
46
|
+
document to an existing local project, using Overleaf's Git access.
|
|
47
|
+
|
|
48
|
+
## 2. Clone it
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
calkit clone OWNER/NAME ~/calkit/NAME
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`~/calkit/` is the usual place, unless the person keeps projects elsewhere,
|
|
55
|
+
e.g., `~/research` or `~/dev`.
|
|
56
|
+
|
|
57
|
+
## 3. Find what the document shows and where it came from
|
|
58
|
+
|
|
59
|
+
Read the document's `.tex` files and list:
|
|
60
|
+
|
|
61
|
+
- figures included from files in the document's folder, e.g., a pasted
|
|
62
|
+
`\includegraphics{drag.png}`
|
|
63
|
+
- numbers typed into the text that are results, e.g., a mean or a fit
|
|
64
|
+
parameter
|
|
65
|
+
- tables typed or pasted in
|
|
66
|
+
|
|
67
|
+
Then find the scripts and data that made them. Ask the person where they
|
|
68
|
+
keep their analysis before searching their files. Match a figure to its
|
|
69
|
+
script by its file name, `savefig` calls, axis labels, and data columns.
|
|
70
|
+
Don't move or delete anything in their folders; copy what the project needs.
|
|
71
|
+
|
|
72
|
+
## 4. Bring in the scripts and data
|
|
73
|
+
|
|
74
|
+
Copy scripts into `scripts/` and data into `data/`, then change paths in the
|
|
75
|
+
scripts to be relative to the project root. Where a number in the text comes
|
|
76
|
+
from a script, have the script write it to a results file, e.g.,
|
|
77
|
+
`results/drag.json`, rather than only printing it.
|
|
78
|
+
|
|
79
|
+
Add each script as a stage, previewing first:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
calkit xr scripts/plot_drag.py --dry-run
|
|
83
|
+
calkit xr scripts/plot_drag.py
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Check the detected inputs, outputs, and environment in `calkit.yaml`. Large
|
|
87
|
+
data belongs in DVC; see the conventions skill.
|
|
88
|
+
|
|
89
|
+
## 5. Have the document read the outputs
|
|
90
|
+
|
|
91
|
+
Load the package and swap each pasted figure and typed result for the
|
|
92
|
+
output that makes it:
|
|
93
|
+
|
|
94
|
+
```latex
|
|
95
|
+
\usepackage{calkit}
|
|
96
|
+
...
|
|
97
|
+
The mean drag coefficient was \ckvalue{results/drag.json}{mean_cd}.
|
|
98
|
+
\ckfigure[width=0.6\linewidth]{figures/drag.png}
|
|
99
|
+
\cktable{results/summary.tex}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Remove the pasted copies the document no longer includes, and drop them from
|
|
103
|
+
the LaTeX stage's `inputs`.
|
|
104
|
+
|
|
105
|
+
## 6. Say where everything starts
|
|
106
|
+
|
|
107
|
+
Data at the start of the chain needs an origin: `created_by` for data the
|
|
108
|
+
person measured or collected, or `imported_from` with a public URL or DOI
|
|
109
|
+
for data from elsewhere. A file on their laptop or a private drive isn't
|
|
110
|
+
somewhere it can be imported from. Ask the person which it is; don't guess.
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
datasets:
|
|
114
|
+
- path: data/drag_data_FINAL.csv
|
|
115
|
+
title: Drag measurements
|
|
116
|
+
created_by:
|
|
117
|
+
- name: Their Name
|
|
118
|
+
email: them@example.edu
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
A PNG or PDF can't be created by a person, since an app or script exports
|
|
122
|
+
it. If no script makes it, ask the person what they made it in, copy that
|
|
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:
|
|
127
|
+
|
|
128
|
+
```yaml
|
|
129
|
+
pipeline:
|
|
130
|
+
stages:
|
|
131
|
+
export-setup:
|
|
132
|
+
kind: inkscape-export # or gimp-export
|
|
133
|
+
source_path: figures/src/setup.svg
|
|
134
|
+
outputs:
|
|
135
|
+
- paper/setup.png
|
|
136
|
+
export-diagram:
|
|
137
|
+
kind: manual-step
|
|
138
|
+
message: In PowerPoint, export paper/diagram.png from slide 2
|
|
139
|
+
open:
|
|
140
|
+
app: PowerPoint
|
|
141
|
+
path: figures/src/diagram.pptx
|
|
142
|
+
inputs:
|
|
143
|
+
- figures/src/diagram.pptx
|
|
144
|
+
outputs:
|
|
145
|
+
- paper/diagram.png
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 7. Run, save, and sync
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
calkit run --save --overleaf -m "Make the drag figure from its script"
|
|
152
|
+
calkit check repro
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Then, in the Overleaf tab:
|
|
156
|
+
|
|
157
|
+
1. Dismiss Overleaf's "Document Updated Externally" notice, if shown.
|
|
158
|
+
2. Reload the page, since the extension remembers what it last looked up.
|
|
159
|
+
3. Recompile, and check that no "Origin not defined" marks remain in the
|
|
160
|
+
editor or on the PDF.
|
|
161
|
+
4. Hover a `\ckvalue` or `\ckfigure` to confirm it traces back to its stage
|
|
162
|
+
and data.
|
|
163
|
+
|
|
164
|
+
Tell the person what you connected, what you asked them about, and anything
|
|
165
|
+
left without an origin.
|
calkit/cli/main/core.py
CHANGED
|
@@ -5460,7 +5460,18 @@ def run_jupyter(
|
|
|
5460
5460
|
help: Annotated[bool, typer.Option("-h", "--help")] = False,
|
|
5461
5461
|
) -> None:
|
|
5462
5462
|
"""Run a command with the Jupyter CLI."""
|
|
5463
|
-
|
|
5463
|
+
args = sys.argv[2:]
|
|
5464
|
+
# Starting a server, not a subcommand like `server list`, in a scheduler
|
|
5465
|
+
# job is an interactive session worth tracking
|
|
5466
|
+
if (
|
|
5467
|
+
args
|
|
5468
|
+
and args[0] in ("lab", "notebook", "server")
|
|
5469
|
+
and (len(args) == 1 or args[1].startswith("-"))
|
|
5470
|
+
):
|
|
5471
|
+
from calkit.cli.scheduler import record_interactive_job
|
|
5472
|
+
|
|
5473
|
+
record_interactive_job("jupyter")
|
|
5474
|
+
process = subprocess.run([sys.executable, "-m", "jupyter"] + args)
|
|
5464
5475
|
sys.exit(process.returncode)
|
|
5465
5476
|
|
|
5466
5477
|
|
calkit/cli/scheduler.py
CHANGED
|
@@ -144,6 +144,35 @@ def _record_job_result(name: str, exit_code: int) -> None:
|
|
|
144
144
|
jobs[name] = info
|
|
145
145
|
|
|
146
146
|
|
|
147
|
+
def record_interactive_job(prefix: str) -> None:
|
|
148
|
+
"""Record the scheduler job we're running in, if any.
|
|
149
|
+
|
|
150
|
+
Interactive sessions, e.g., a Jupyter server started with ``srun`` from
|
|
151
|
+
VS Code, aren't submitted by Calkit but still hold an allocation for the
|
|
152
|
+
project, so ``scheduler queue`` and ``cancel`` should see them. The
|
|
153
|
+
record is for the allocation, which can outlive or be shared by several
|
|
154
|
+
sessions, so it stays until ``queue`` finds the job gone.
|
|
155
|
+
"""
|
|
156
|
+
kind, job_id = None, None
|
|
157
|
+
if os.getenv("SLURM_JOB_ID"):
|
|
158
|
+
kind, job_id = "slurm", os.environ["SLURM_JOB_ID"]
|
|
159
|
+
elif os.getenv("PBS_JOBID"):
|
|
160
|
+
kind, job_id = "pbs", os.environ["PBS_JOBID"]
|
|
161
|
+
if job_id is None or not os.path.isfile("calkit.yaml"):
|
|
162
|
+
return
|
|
163
|
+
# The colon keeps it apart from stage records, since stage names can't
|
|
164
|
+
# contain one
|
|
165
|
+
_record_job(
|
|
166
|
+
f"{prefix}:{job_id}",
|
|
167
|
+
{
|
|
168
|
+
"kind": kind,
|
|
169
|
+
"job_id": job_id,
|
|
170
|
+
"interactive": True,
|
|
171
|
+
"submitted_at": calkit.utcnow().isoformat(),
|
|
172
|
+
},
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
|
|
147
176
|
def _mock_enabled() -> bool:
|
|
148
177
|
"""Whether scheduler commands should run jobs locally.
|
|
149
178
|
|
|
@@ -504,7 +533,7 @@ def _count_queued_jobs(environment: str, exclude: str) -> int:
|
|
|
504
533
|
"""
|
|
505
534
|
by_kind: dict[str, list[str]] = {}
|
|
506
535
|
for job_name, info in _load_jobs().items():
|
|
507
|
-
if job_name == exclude:
|
|
536
|
+
if job_name == exclude or info.get("interactive"):
|
|
508
537
|
continue
|
|
509
538
|
# Records written before environments were tracked have no
|
|
510
539
|
# environment key. Count them: over-counting delays a submission,
|
|
@@ -1478,7 +1507,10 @@ def _build_pbs_submit(
|
|
|
1478
1507
|
|
|
1479
1508
|
@scheduler_app.command(name="queue|q")
|
|
1480
1509
|
def get_queue() -> None:
|
|
1481
|
-
"""List scheduler jobs submitted via Calkit (across SLURM and PBS).
|
|
1510
|
+
"""List scheduler jobs submitted via Calkit (across SLURM and PBS).
|
|
1511
|
+
|
|
1512
|
+
Includes interactive jobs, e.g., Jupyter servers for notebooks.
|
|
1513
|
+
"""
|
|
1482
1514
|
jobs = _load_jobs()
|
|
1483
1515
|
if not jobs:
|
|
1484
1516
|
typer.echo("No jobs found for this project")
|
|
@@ -1495,18 +1527,32 @@ def get_queue() -> None:
|
|
|
1495
1527
|
by_kind.setdefault(info.get("kind", "slurm"), []).append(
|
|
1496
1528
|
info["job_id"]
|
|
1497
1529
|
)
|
|
1498
|
-
|
|
1530
|
+
# Only ask about live jobs, since squeue errors on purged IDs
|
|
1531
|
+
active = {
|
|
1532
|
+
kind: _active_job_ids(kind, job_ids)
|
|
1533
|
+
for kind, job_ids in by_kind.items()
|
|
1534
|
+
}
|
|
1535
|
+
for job_name, info in jobs.items():
|
|
1536
|
+
kind = info.get("kind", "slurm")
|
|
1537
|
+
if info.get("interactive") and info["job_id"] not in active[kind]:
|
|
1538
|
+
_delete_job(job_name)
|
|
1539
|
+
if not any(active.values()):
|
|
1540
|
+
typer.echo("No queued or running jobs for this project")
|
|
1541
|
+
raise typer.Exit(0)
|
|
1542
|
+
for kind, job_ids in active.items():
|
|
1543
|
+
if not job_ids:
|
|
1544
|
+
continue
|
|
1499
1545
|
query_bin = _BINARIES[kind]["query"]
|
|
1500
1546
|
if kind == "slurm":
|
|
1501
1547
|
subprocess.run(
|
|
1502
|
-
[query_bin, "-j", ",".join(job_ids)],
|
|
1548
|
+
[query_bin, "-j", ",".join(sorted(job_ids))],
|
|
1503
1549
|
capture_output=False,
|
|
1504
1550
|
text=True,
|
|
1505
1551
|
check=False,
|
|
1506
1552
|
)
|
|
1507
1553
|
else:
|
|
1508
1554
|
subprocess.run(
|
|
1509
|
-
[query_bin] + job_ids,
|
|
1555
|
+
[query_bin] + sorted(job_ids),
|
|
1510
1556
|
capture_output=False,
|
|
1511
1557
|
text=True,
|
|
1512
1558
|
check=False,
|
calkit/latex.py
CHANGED
|
@@ -456,19 +456,12 @@ def _strip_comments_joined(tex: str) -> str:
|
|
|
456
456
|
return "".join(out)
|
|
457
457
|
|
|
458
458
|
|
|
459
|
-
def
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
this, detection would depend on whether the caller had pulled, and a
|
|
466
|
-
server working from a fresh clone would miss every DVC-tracked figure.
|
|
467
|
-
"""
|
|
468
|
-
return (base / rel).is_file() or (base / f"{rel}.dvc").is_file()
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
def detect_inputs(target_path: str, wdir: str | None = None) -> list[str]:
|
|
459
|
+
def detect_inputs(
|
|
460
|
+
target_path: str,
|
|
461
|
+
wdir: str | None = None,
|
|
462
|
+
is_output: Callable[[str], bool] | None = None,
|
|
463
|
+
is_exact_output: Callable[[str], bool] | None = None,
|
|
464
|
+
) -> list[str]:
|
|
472
465
|
"""Find the project files a LaTeX document reads.
|
|
473
466
|
|
|
474
467
|
A document's class, style, bibliography, and figure files are inputs
|
|
@@ -489,14 +482,39 @@ def detect_inputs(target_path: str, wdir: str | None = None) -> list[str]:
|
|
|
489
482
|
Paths are returned relative to ``wdir`` -- the same frame as
|
|
490
483
|
``target_path`` and the rest of a stage's paths -- sorted, and with
|
|
491
484
|
the target itself excluded (it's already a dependency).
|
|
485
|
+
|
|
486
|
+
``is_output`` says if the file is created by a pipeline stage, taking paths
|
|
487
|
+
in that frame. Such a figure is an input even before the stage first
|
|
488
|
+
makes it, e.g., on a fresh clone, when it isn't in the project yet.
|
|
489
|
+
``is_exact_output`` says if a stage declares it as is, rather than by
|
|
490
|
+
matching an iterated stage's output pattern.
|
|
492
491
|
"""
|
|
493
492
|
base = Path(wdir) if wdir else Path(".")
|
|
494
|
-
|
|
493
|
+
# Each folder is listed once, since most names tried aren't there, e.g.,
|
|
494
|
+
# every package from TeX Live, with each extension TeX would try
|
|
495
|
+
listings: dict[str, set[str]] = {}
|
|
496
|
+
|
|
497
|
+
def is_project_file(rel: str) -> bool:
|
|
498
|
+
folder, name = posixpath.split(rel)
|
|
499
|
+
if folder not in listings:
|
|
500
|
+
try:
|
|
501
|
+
listings[folder] = set(os.listdir(base / folder))
|
|
502
|
+
except OSError:
|
|
503
|
+
listings[folder] = set()
|
|
504
|
+
# A DVC-tracked figure isn't in the working tree until it's pulled,
|
|
505
|
+
# but its .dvc pointer is in Git, and it's every bit as much an
|
|
506
|
+
# input as one stored directly
|
|
507
|
+
listed = listings[folder]
|
|
508
|
+
if name in listed and (base / rel).is_file():
|
|
509
|
+
return True
|
|
510
|
+
return f"{name}.dvc" in listed
|
|
511
|
+
|
|
512
|
+
root = posixpath.normpath(Path(target_path).as_posix())
|
|
495
513
|
found: set[str] = set()
|
|
496
514
|
# Source files whose own inputs still need collecting, and everything
|
|
497
515
|
# already visited, so a pair of files including each other terminates.
|
|
498
516
|
queue = [root]
|
|
499
|
-
seen = {root
|
|
517
|
+
seen = {root}
|
|
500
518
|
while queue:
|
|
501
519
|
current = queue.pop()
|
|
502
520
|
try:
|
|
@@ -505,33 +523,59 @@ def detect_inputs(target_path: str, wdir: str | None = None) -> list[str]:
|
|
|
505
523
|
)
|
|
506
524
|
except (OSError, UnicodeDecodeError):
|
|
507
525
|
continue
|
|
526
|
+
# TeX resolves a reference against the compile's working directory,
|
|
527
|
+
# which is the root document's; a nested file written as if paths
|
|
528
|
+
# were relative to itself is common enough to try too
|
|
529
|
+
parents = list(
|
|
530
|
+
dict.fromkeys(
|
|
531
|
+
[posixpath.dirname(root), posixpath.dirname(current)]
|
|
532
|
+
)
|
|
533
|
+
)
|
|
508
534
|
for command, arg in _INPUT_RE.findall(tex):
|
|
509
535
|
for raw in [n.strip() for n in arg.split(",")]:
|
|
510
|
-
|
|
536
|
+
# A macro's parameter, e.g., #1, or a name built from macros
|
|
537
|
+
# isn't a file
|
|
538
|
+
if (
|
|
539
|
+
not raw
|
|
540
|
+
or "#" in raw
|
|
541
|
+
or "\\" in raw
|
|
542
|
+
or raw.startswith(("http://", "https://"))
|
|
543
|
+
):
|
|
511
544
|
continue
|
|
512
|
-
#
|
|
513
|
-
#
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
raw + ext for ext in _INPUT_COMMANDS[command] if ext
|
|
519
|
-
]
|
|
545
|
+
# Names as written come first, and TeX doesn't add an
|
|
546
|
+
# extension to one already carrying one it would try
|
|
547
|
+
exts = _INPUT_COMMANDS[command]
|
|
548
|
+
names = [raw]
|
|
549
|
+
if posixpath.splitext(raw)[1] not in exts:
|
|
550
|
+
names += [raw + ext for ext in exts if ext]
|
|
520
551
|
candidates = [
|
|
521
|
-
parent
|
|
552
|
+
posixpath.normpath(posixpath.join(parent, name))
|
|
522
553
|
for name in names
|
|
523
|
-
for parent in
|
|
554
|
+
for parent in parents
|
|
524
555
|
]
|
|
525
|
-
for
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
556
|
+
candidates = [c for c in candidates if not c.startswith("..")]
|
|
557
|
+
# A name a stage only might make, by matching an iterated
|
|
558
|
+
# stage's output pattern, is tried last, since such a pattern
|
|
559
|
+
# can match most names
|
|
560
|
+
rel = next(
|
|
561
|
+
(
|
|
562
|
+
c
|
|
563
|
+
for c in candidates
|
|
564
|
+
if is_project_file(c)
|
|
565
|
+
or (is_exact_output is not None and is_exact_output(c))
|
|
566
|
+
),
|
|
567
|
+
None,
|
|
568
|
+
)
|
|
569
|
+
if rel is None and is_output is not None:
|
|
570
|
+
rel = next((c for c in candidates if is_output(c)), None)
|
|
571
|
+
if rel is None:
|
|
572
|
+
continue
|
|
573
|
+
if rel != root:
|
|
574
|
+
found.add(rel)
|
|
575
|
+
is_source = posixpath.splitext(rel)[1] in _SOURCE_EXTS
|
|
576
|
+
if is_source and rel not in seen:
|
|
577
|
+
seen.add(rel)
|
|
578
|
+
queue.append(rel)
|
|
535
579
|
return sorted(found)
|
|
536
580
|
|
|
537
581
|
|
calkit/models/pipeline.py
CHANGED
|
@@ -670,12 +670,15 @@ class Stage(Model):
|
|
|
670
670
|
project_dir: str | None,
|
|
671
671
|
is_output: Callable[[str], bool],
|
|
672
672
|
write_files: bool = False,
|
|
673
|
+
is_exact_output: Callable[[str], bool] | None = None,
|
|
673
674
|
) -> None:
|
|
674
675
|
"""Work out what the stage depends on from the project before it's
|
|
675
676
|
compiled, for a kind of stage whose sources name some of it.
|
|
676
677
|
|
|
677
678
|
``project_dir`` is where the project is, and ``is_output`` says
|
|
678
|
-
whether a stage makes a project path
|
|
679
|
+
whether a stage makes a project path, including by matching an
|
|
680
|
+
iterated stage's output pattern, while ``is_exact_output`` says
|
|
681
|
+
whether a stage declares it as is. With ``write_files``, the stage also
|
|
679
682
|
writes files it reads that aren't kept in the project, since it's
|
|
680
683
|
about to run or have its status checked. That happens on every
|
|
681
684
|
call, so only fast work belongs here.
|
|
@@ -1502,6 +1505,7 @@ class LatexStage(Stage):
|
|
|
1502
1505
|
project_dir: str | None,
|
|
1503
1506
|
is_output: Callable[[str], bool],
|
|
1504
1507
|
write_files: bool = False,
|
|
1508
|
+
is_exact_output: Callable[[str], bool] | None = None,
|
|
1505
1509
|
) -> None:
|
|
1506
1510
|
"""Read which components the document includes with calkit.sty's
|
|
1507
1511
|
commands, since they're as much inputs as its source, and with
|
|
@@ -1554,6 +1558,20 @@ class LatexStage(Stage):
|
|
|
1554
1558
|
and not is_output(rel)
|
|
1555
1559
|
):
|
|
1556
1560
|
copied.append(rel)
|
|
1561
|
+
# What it includes plainly, e.g., with \includegraphics, is as much
|
|
1562
|
+
# an input, e.g., a figure a stage exports
|
|
1563
|
+
wdir = self.wdir or ""
|
|
1564
|
+
for rel in calkit.latex.detect_inputs(
|
|
1565
|
+
self.target_path,
|
|
1566
|
+
wdir=os.path.join(project_dir or "", wdir),
|
|
1567
|
+
is_output=lambda p: is_output(posixpath.join(wdir, p)),
|
|
1568
|
+
is_exact_output=(
|
|
1569
|
+
None
|
|
1570
|
+
if is_exact_output is None
|
|
1571
|
+
else lambda p: is_exact_output(posixpath.join(wdir, p))
|
|
1572
|
+
),
|
|
1573
|
+
):
|
|
1574
|
+
paths.append(posixpath.normpath(posixpath.join(wdir, rel)))
|
|
1557
1575
|
self._component_paths = list(dict.fromkeys(paths))
|
|
1558
1576
|
self._copied_paths = list(dict.fromkeys(copied))
|
|
1559
1577
|
if write_files and self._loads_calkit:
|
|
@@ -1580,14 +1598,23 @@ class LatexStage(Stage):
|
|
|
1580
1598
|
posixpath.join(components_dir, calkit.latex.VALUES_FNAME),
|
|
1581
1599
|
] + [posixpath.join(components_dir, p) for p in self._copied_paths]
|
|
1582
1600
|
|
|
1601
|
+
@property
|
|
1602
|
+
def found_paths(self) -> list[str]:
|
|
1603
|
+
"""What the document reads that preprocessing found, relative to the
|
|
1604
|
+
stage's ``wdir``.
|
|
1605
|
+
"""
|
|
1606
|
+
return [self.path_from_wdir(p) for p in self._component_paths]
|
|
1607
|
+
|
|
1583
1608
|
@property
|
|
1584
1609
|
def dvc_deps(self) -> list[str]:
|
|
1585
1610
|
# The copies the document reads, and what they're copied from, so it
|
|
1586
|
-
# builds after the stages making them
|
|
1611
|
+
# builds after the stages making them, unless in a folder it declares
|
|
1612
|
+
declared = super().dvc_deps
|
|
1613
|
+
folders = tuple(d.rstrip("/") + "/" for d in declared)
|
|
1587
1614
|
deps = (
|
|
1588
1615
|
[self.target_path]
|
|
1589
|
-
+
|
|
1590
|
-
+ [
|
|
1616
|
+
+ declared
|
|
1617
|
+
+ [p for p in self.found_paths if not p.startswith(folders)]
|
|
1591
1618
|
+ self.component_copies
|
|
1592
1619
|
)
|
|
1593
1620
|
if self.latexmkrc_path is not None:
|
|
@@ -3183,7 +3210,12 @@ class Pipeline(Model):
|
|
|
3183
3210
|
return path in outputs or any(p.match(path) for p in patterns)
|
|
3184
3211
|
|
|
3185
3212
|
for stage in self.stages.values():
|
|
3186
|
-
stage.preprocess(
|
|
3213
|
+
stage.preprocess(
|
|
3214
|
+
project_dir,
|
|
3215
|
+
is_output,
|
|
3216
|
+
write_files=write_files,
|
|
3217
|
+
is_exact_output=outputs.__contains__,
|
|
3218
|
+
)
|
|
3187
3219
|
|
|
3188
3220
|
def resolve_procedure_paths(self, procedures: dict) -> None:
|
|
3189
3221
|
"""Tell procedure stages where their procedure is written down.
|
calkit/overleaf.py
CHANGED
|
@@ -2147,6 +2147,28 @@ def sync(
|
|
|
2147
2147
|
main_repo.git.add(src_rel)
|
|
2148
2148
|
if src_rel not in paths_to_commit:
|
|
2149
2149
|
paths_to_commit.append(src_rel)
|
|
2150
|
+
# What the document shows from the project is what its stage reads,
|
|
2151
|
+
# so the compiled pipeline follows edits that came from Overleaf, or
|
|
2152
|
+
# the paper wouldn't rebuild when something new it shows changes
|
|
2153
|
+
# One the project doesn't keep in Git is left alone
|
|
2154
|
+
if res["commits_since_last_sync"] and main_repo.git.ls_files("dvc.yaml"):
|
|
2155
|
+
try:
|
|
2156
|
+
from calkit.pipeline import to_dvc
|
|
2157
|
+
|
|
2158
|
+
wdir = str(main_repo.working_dir)
|
|
2159
|
+
ck_info = calkit.load_calkit_info(wdir=wdir)
|
|
2160
|
+
if ck_info.get("pipeline"):
|
|
2161
|
+
to_dvc(
|
|
2162
|
+
ck_info=ck_info,
|
|
2163
|
+
wdir=wdir,
|
|
2164
|
+
write=True,
|
|
2165
|
+
manage_gitignore=False,
|
|
2166
|
+
)
|
|
2167
|
+
if main_repo.git.status("--porcelain", "--", "dvc.yaml"):
|
|
2168
|
+
main_repo.git.add("dvc.yaml")
|
|
2169
|
+
paths_to_commit.append("dvc.yaml")
|
|
2170
|
+
except Exception as e:
|
|
2171
|
+
print_info(f"Not updating dvc.yaml with the sync: {e}")
|
|
2150
2172
|
if gitignore_modified:
|
|
2151
2173
|
paths_to_commit.append(".gitignore")
|
|
2152
2174
|
if style_ignore_source and style_ignore_source not in paths_to_commit:
|
calkit/pipeline.py
CHANGED
|
@@ -3001,6 +3001,15 @@ def to_dvc(
|
|
|
3001
3001
|
else:
|
|
3002
3002
|
stage_output_paths.append(out)
|
|
3003
3003
|
dvc_stages[stage_name]["deps"].append(out)
|
|
3004
|
+
# What a document reads from a folder those stages make is covered
|
|
3005
|
+
if stage_output_paths and isinstance(stage, LatexStage):
|
|
3006
|
+
folders = tuple(p.rstrip("/") + "/" for p in stage_output_paths)
|
|
3007
|
+
found = set(stage.found_paths)
|
|
3008
|
+
dvc_stages[stage_name]["deps"] = [
|
|
3009
|
+
d
|
|
3010
|
+
for d in dvc_stages[stage_name]["deps"]
|
|
3011
|
+
if d not in found or not d.startswith(folders)
|
|
3012
|
+
]
|
|
3004
3013
|
# Stages generated from this one read these too, e.g., a latex
|
|
3005
3014
|
# stage's diffs, but the paths are only known now
|
|
3006
3015
|
if stage_output_paths:
|
|
@@ -31,6 +31,7 @@ from calkit.cli.scheduler import (
|
|
|
31
31
|
_slurm_exit_code,
|
|
32
32
|
_wait_for_output_file,
|
|
33
33
|
_wait_until_done,
|
|
34
|
+
record_interactive_job,
|
|
34
35
|
)
|
|
35
36
|
|
|
36
37
|
|
|
@@ -512,6 +513,78 @@ def test_count_queued_jobs(tmp_dir, monkeypatch):
|
|
|
512
513
|
# over-counting delays a submission, under-counting floods the queue.
|
|
513
514
|
_record_job("e", {"kind": "slurm", "job_id": "5"})
|
|
514
515
|
assert _count_queued_jobs("hpc", exclude="none") == 3
|
|
516
|
+
# Interactive sessions don't take a slot from pipeline jobs
|
|
517
|
+
active.add("6")
|
|
518
|
+
_record_job("f", {"kind": "slurm", "job_id": "6", "interactive": True})
|
|
519
|
+
assert _count_queued_jobs("hpc", exclude="none") == 3
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
def test_record_interactive_job(tmp_dir, monkeypatch):
|
|
523
|
+
monkeypatch.delenv("SLURM_JOB_ID", raising=False)
|
|
524
|
+
monkeypatch.delenv("PBS_JOBID", raising=False)
|
|
525
|
+
# Outside a scheduler job, nothing is recorded
|
|
526
|
+
with open("calkit.yaml", "w") as f:
|
|
527
|
+
f.write("name: test\n")
|
|
528
|
+
record_interactive_job("jupyter")
|
|
529
|
+
assert _load_jobs() == {}
|
|
530
|
+
# Inside a SLURM job, the allocation is recorded, once however many
|
|
531
|
+
# sessions it runs
|
|
532
|
+
monkeypatch.setenv("SLURM_JOB_ID", "123")
|
|
533
|
+
record_interactive_job("jupyter")
|
|
534
|
+
record_interactive_job("jupyter")
|
|
535
|
+
jobs = _load_jobs()
|
|
536
|
+
assert list(jobs) == ["jupyter:123"]
|
|
537
|
+
assert jobs["jupyter:123"]["kind"] == "slurm"
|
|
538
|
+
assert jobs["jupyter:123"]["job_id"] == "123"
|
|
539
|
+
assert jobs["jupyter:123"]["interactive"]
|
|
540
|
+
# PBS jobs too
|
|
541
|
+
monkeypatch.delenv("SLURM_JOB_ID")
|
|
542
|
+
monkeypatch.setenv("PBS_JOBID", "456.server")
|
|
543
|
+
record_interactive_job("jupyter")
|
|
544
|
+
assert _load_jobs()["jupyter:456.server"]["kind"] == "pbs"
|
|
545
|
+
# Outside a project, there's nowhere to record it
|
|
546
|
+
os.remove("calkit.yaml")
|
|
547
|
+
monkeypatch.setenv("PBS_JOBID", "789.server")
|
|
548
|
+
record_interactive_job("jupyter")
|
|
549
|
+
assert "jupyter:789.server" not in _load_jobs()
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
def test_get_queue(tmp_dir, monkeypatch, capsys):
|
|
553
|
+
monkeypatch.delenv(sched.MOCK_ENV_VAR, raising=False)
|
|
554
|
+
calls = []
|
|
555
|
+
monkeypatch.setattr(
|
|
556
|
+
sched.subprocess, "run", lambda cmd, **kwargs: calls.append(cmd)
|
|
557
|
+
)
|
|
558
|
+
active = {"1", "3"}
|
|
559
|
+
monkeypatch.setattr(
|
|
560
|
+
sched,
|
|
561
|
+
"_active_job_ids",
|
|
562
|
+
lambda kind, job_ids: {j for j in job_ids if j in active},
|
|
563
|
+
)
|
|
564
|
+
with pytest.raises(typer.Exit):
|
|
565
|
+
sched.get_queue()
|
|
566
|
+
assert "No jobs found" in capsys.readouterr().out
|
|
567
|
+
_record_job("stage", {"kind": "slurm", "job_id": "1"})
|
|
568
|
+
_record_job("old-stage", {"kind": "slurm", "job_id": "2"})
|
|
569
|
+
_record_job(
|
|
570
|
+
"jupyter:3", {"kind": "slurm", "job_id": "3", "interactive": True}
|
|
571
|
+
)
|
|
572
|
+
_record_job(
|
|
573
|
+
"jupyter:4", {"kind": "slurm", "job_id": "4", "interactive": True}
|
|
574
|
+
)
|
|
575
|
+
sched.get_queue()
|
|
576
|
+
# Only live jobs are queried, since squeue errors on purged IDs
|
|
577
|
+
assert calls == [["squeue", "-j", "1,3"]]
|
|
578
|
+
# Interactive sessions that ended are dropped; pipeline records stay
|
|
579
|
+
assert set(_load_jobs()) == {"stage", "old-stage", "jupyter:3"}
|
|
580
|
+
# Nothing live
|
|
581
|
+
active.clear()
|
|
582
|
+
calls.clear()
|
|
583
|
+
with pytest.raises(typer.Exit):
|
|
584
|
+
sched.get_queue()
|
|
585
|
+
assert "No queued or running jobs" in capsys.readouterr().out
|
|
586
|
+
assert calls == []
|
|
587
|
+
assert set(_load_jobs()) == {"stage", "old-stage"}
|
|
515
588
|
|
|
516
589
|
|
|
517
590
|
def test_queue_slot_waits_for_room(tmp_dir, monkeypatch):
|
calkit/tests/test_overleaf.py
CHANGED
|
@@ -159,8 +159,19 @@ def test_sync_ck_components(tmp_dir):
|
|
|
159
159
|
ck_info["overleaf_sync"] = {
|
|
160
160
|
"paper": {"url": "https://www.overleaf.com/project/abc123"}
|
|
161
161
|
}
|
|
162
|
+
ck_info["environments"] = {"tex": {"kind": "docker", "image": "texlive"}}
|
|
163
|
+
ck_info["pipeline"] = {
|
|
164
|
+
"stages": {
|
|
165
|
+
"build-paper": {
|
|
166
|
+
"kind": "latex",
|
|
167
|
+
"environment": "tex",
|
|
168
|
+
"target_path": "paper/main.tex",
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
162
172
|
with open("calkit.yaml", "w") as f:
|
|
163
173
|
calkit.ryaml.dump(ck_info, f)
|
|
174
|
+
calkit.pipeline.to_dvc(write=True)
|
|
164
175
|
_commit_all(repo, "Link paper")
|
|
165
176
|
overleaf_dir = tmp_dir / "overleaf"
|
|
166
177
|
os.makedirs(overleaf_dir)
|
|
@@ -219,6 +230,11 @@ def test_sync_ck_components(tmp_dir):
|
|
|
219
230
|
with open(overleaf_dir / "_calkit" / "values.tex") as f:
|
|
220
231
|
assert "{1.5}" in f.read()
|
|
221
232
|
assert status()["in_sync"]
|
|
233
|
+
# The paper's stage reads what it now shows, committed with the sync
|
|
234
|
+
with open("dvc.yaml") as f:
|
|
235
|
+
deps = calkit.ryaml.load(f)["stages"]["build-paper"]["deps"]
|
|
236
|
+
assert {"figures/plot.png", "results/m.json"} <= set(deps)
|
|
237
|
+
assert not repo.git.status("--porcelain", "--", "dvc.yaml")
|
|
222
238
|
# What Calkit writes is pushed, but kept out of the project's Git
|
|
223
239
|
assert "paper/calkit.sty" not in calkit.git.ls_files(repo)
|
|
224
240
|
assert repo.ignored("paper/calkit.sty")
|
calkit/tests/test_pipeline.py
CHANGED
|
@@ -1764,6 +1764,12 @@ def test_to_dvc_latex_component_deps(tmp_dir):
|
|
|
1764
1764
|
"\\ckfigure{figures/photo.png}\n"
|
|
1765
1765
|
"\\ckvalue{data/summary.json}{n}\n"
|
|
1766
1766
|
"\\ckvalue{../outside.json}{secret}\n"
|
|
1767
|
+
"\\includegraphics{figures/drawn}\n"
|
|
1768
|
+
"\\includegraphics{figures/exported.png}\n"
|
|
1769
|
+
"\\includegraphics{figures/rebuilt}\n"
|
|
1770
|
+
"\\newcommand{\\fig}[1]{\\includegraphics{figures/#1}}\n"
|
|
1771
|
+
"\\includegraphics{\\figdir/macro}\n"
|
|
1772
|
+
"\\includegraphics{figures/missing.jpeg}\n"
|
|
1767
1773
|
"\\end{document}\n"
|
|
1768
1774
|
)
|
|
1769
1775
|
with open("paper/sections/results.tex", "w") as f:
|
|
@@ -1778,10 +1784,16 @@ def test_to_dvc_latex_component_deps(tmp_dir):
|
|
|
1778
1784
|
"\\begin{document}\n"
|
|
1779
1785
|
"\\ckvalue{results/other.json}{x}\n\\end{document}\n"
|
|
1780
1786
|
)
|
|
1781
|
-
# A figure no stage makes
|
|
1787
|
+
# A figure no stage makes, and one included plainly, beside the paper
|
|
1782
1788
|
os.makedirs("figures")
|
|
1783
1789
|
with open("figures/photo.png", "wb") as fb:
|
|
1784
1790
|
fb.write(b"photo")
|
|
1791
|
+
os.makedirs("paper/figures")
|
|
1792
|
+
with open("paper/figures/drawn.png", "wb") as fb:
|
|
1793
|
+
fb.write(b"drawn")
|
|
1794
|
+
# Left over from before a stage made it as a PDF
|
|
1795
|
+
with open("paper/figures/rebuilt.png", "wb") as fb:
|
|
1796
|
+
fb.write(b"rebuilt")
|
|
1785
1797
|
os.makedirs("results")
|
|
1786
1798
|
for name, content in [
|
|
1787
1799
|
("metrics", '{"rmse": 0.123}'),
|
|
@@ -1790,7 +1802,7 @@ def test_to_dvc_latex_component_deps(tmp_dir):
|
|
|
1790
1802
|
with open(f"results/{name}.json", "w") as f:
|
|
1791
1803
|
f.write(content)
|
|
1792
1804
|
# Components kept in other ways, in a document of their own
|
|
1793
|
-
os.makedirs("extra")
|
|
1805
|
+
os.makedirs("extra/plots")
|
|
1794
1806
|
with open("extra/main.tex", "w") as f:
|
|
1795
1807
|
f.write(
|
|
1796
1808
|
"\\documentclass{article}\n\\usepackage{calkit}\n"
|
|
@@ -1798,13 +1810,18 @@ def test_to_dvc_latex_component_deps(tmp_dir):
|
|
|
1798
1810
|
"\\ckfigure{maps/world}\n\\ckfigure{maps/typo.png}\n"
|
|
1799
1811
|
"\\ckfigure{photos/cat}\n\\ckfigure{images/logo.png}\n"
|
|
1800
1812
|
"\\ckfigure{figures/fit_1.5}\n\\ckfigure{figures/sweep-2}\n"
|
|
1813
|
+
"\\includegraphics{plots/a}\n"
|
|
1801
1814
|
"\\end{document}\n"
|
|
1802
1815
|
)
|
|
1803
1816
|
os.makedirs("images")
|
|
1804
1817
|
for path in ["images/logo.png", "images/logo.png.dvc", "photos.dvc"]:
|
|
1805
1818
|
with open(path, "w") as f:
|
|
1806
1819
|
f.write("x")
|
|
1807
|
-
for path in [
|
|
1820
|
+
for path in [
|
|
1821
|
+
"figures/fit_1.5.pdf",
|
|
1822
|
+
"figures/sweep-2.png",
|
|
1823
|
+
"extra/plots/a.png",
|
|
1824
|
+
]:
|
|
1808
1825
|
with open(path, "w") as f:
|
|
1809
1826
|
f.write("x")
|
|
1810
1827
|
# Tracked by DVC but not pulled
|
|
@@ -1827,6 +1844,25 @@ def test_to_dvc_latex_component_deps(tmp_dir):
|
|
|
1827
1844
|
"environment": "tex",
|
|
1828
1845
|
"target_path": "paper/main.tex",
|
|
1829
1846
|
},
|
|
1847
|
+
# Exports a figure the paper includes plainly, which isn't
|
|
1848
|
+
# there until it runs
|
|
1849
|
+
"export": {
|
|
1850
|
+
"kind": "command",
|
|
1851
|
+
"environment": "_system",
|
|
1852
|
+
"command": "echo png > paper/figures/exported.png",
|
|
1853
|
+
"outputs": [
|
|
1854
|
+
"paper/figures/exported.png",
|
|
1855
|
+
"paper/figures/rebuilt.pdf",
|
|
1856
|
+
],
|
|
1857
|
+
},
|
|
1858
|
+
# Its outputs are a pattern matching most figure names
|
|
1859
|
+
"render": {
|
|
1860
|
+
"kind": "command",
|
|
1861
|
+
"environment": "_system",
|
|
1862
|
+
"command": "echo {n} > paper/figures/{n}.pdf",
|
|
1863
|
+
"outputs": ["paper/figures/{n}.pdf"],
|
|
1864
|
+
"iterate_over": [{"arg_name": "n", "values": ["a", "b"]}],
|
|
1865
|
+
},
|
|
1830
1866
|
"build-other": {
|
|
1831
1867
|
"kind": "latex",
|
|
1832
1868
|
"environment": "tex",
|
|
@@ -1846,10 +1882,17 @@ def test_to_dvc_latex_component_deps(tmp_dir):
|
|
|
1846
1882
|
"outputs": ["figures/sweep-{n}.png"],
|
|
1847
1883
|
"iterate_over": [{"arg_name": "n", "values": [1, 2]}],
|
|
1848
1884
|
},
|
|
1885
|
+
"plots": {
|
|
1886
|
+
"kind": "command",
|
|
1887
|
+
"environment": "_system",
|
|
1888
|
+
"command": "mkdir -p extra/plots",
|
|
1889
|
+
"outputs": ["extra/plots"],
|
|
1890
|
+
},
|
|
1849
1891
|
"build-extra": {
|
|
1850
1892
|
"kind": "latex",
|
|
1851
1893
|
"environment": "tex",
|
|
1852
1894
|
"target_path": "extra/main.tex",
|
|
1895
|
+
"inputs": [{"from_stage_outputs": "plots"}],
|
|
1853
1896
|
},
|
|
1854
1897
|
# Paths in a stage are relative to its wdir, while component
|
|
1855
1898
|
# paths are relative to the project
|
|
@@ -1858,6 +1901,7 @@ def test_to_dvc_latex_component_deps(tmp_dir):
|
|
|
1858
1901
|
"environment": "tex",
|
|
1859
1902
|
"wdir": "paper",
|
|
1860
1903
|
"target_path": "main.tex",
|
|
1904
|
+
"inputs": ["figures/"],
|
|
1861
1905
|
},
|
|
1862
1906
|
}
|
|
1863
1907
|
},
|
|
@@ -1875,6 +1919,30 @@ def test_to_dvc_latex_component_deps(tmp_dir):
|
|
|
1875
1919
|
"data/summary.json",
|
|
1876
1920
|
} <= set(deps)
|
|
1877
1921
|
assert not any("typo" in d or "outside" in d for d in deps)
|
|
1922
|
+
# What it includes plainly is read just the same, whether it's there or
|
|
1923
|
+
# a stage makes it, and so is a file it inputs
|
|
1924
|
+
assert {
|
|
1925
|
+
"paper/figures/drawn.png",
|
|
1926
|
+
"paper/figures/exported.png",
|
|
1927
|
+
"paper/figures/rebuilt.pdf",
|
|
1928
|
+
"paper/sections/results.tex",
|
|
1929
|
+
} <= set(deps)
|
|
1930
|
+
# But not a macro's parameter, a name built from macros, an extension
|
|
1931
|
+
# added to one already there, or a file that's not there in place of
|
|
1932
|
+
# one that is, just since an iterated stage's outputs match them, though
|
|
1933
|
+
# one a stage declares wins as TeX would pick it
|
|
1934
|
+
assert not [
|
|
1935
|
+
d
|
|
1936
|
+
for d in deps
|
|
1937
|
+
if d.startswith("paper/figures/")
|
|
1938
|
+
and d
|
|
1939
|
+
not in [
|
|
1940
|
+
"paper/figures/drawn.png",
|
|
1941
|
+
"paper/figures/exported.png",
|
|
1942
|
+
"paper/figures/rebuilt.pdf",
|
|
1943
|
+
]
|
|
1944
|
+
]
|
|
1945
|
+
assert not any("#" in d or "macro" in d for d in deps)
|
|
1878
1946
|
# And on the copies it reads, like a cleaned notebook, so a new value or
|
|
1879
1947
|
# calkit.sty rebuilds it, except a figure a stage makes, which is copied
|
|
1880
1948
|
# only after DVC checks the stage's dependencies are there
|
|
@@ -1908,6 +1976,9 @@ def test_to_dvc_latex_component_deps(tmp_dir):
|
|
|
1908
1976
|
assert {"figures/fit_1.5.pdf", "extra/_calkit/figures/fit_1.5.pdf"} <= set(
|
|
1909
1977
|
deps
|
|
1910
1978
|
)
|
|
1979
|
+
# What's in a folder it reads from another stage is already covered
|
|
1980
|
+
assert "extra/plots" in deps
|
|
1981
|
+
assert "extra/plots/a.png" not in deps
|
|
1911
1982
|
deps = stages["build-paper-wdir"]["deps"]
|
|
1912
1983
|
assert {
|
|
1913
1984
|
"../figures/plot.png",
|
|
@@ -1916,6 +1987,9 @@ def test_to_dvc_latex_component_deps(tmp_dir):
|
|
|
1916
1987
|
"_calkit/figures/photo.png",
|
|
1917
1988
|
"calkit.sty",
|
|
1918
1989
|
} <= set(deps)
|
|
1990
|
+
# And so is what's in a folder it declares
|
|
1991
|
+
assert "figures/" in deps
|
|
1992
|
+
assert not any(d.startswith("figures/") and d != "figures/" for d in deps)
|
|
1919
1993
|
# A document that doesn't load calkit.sty depends on no copies
|
|
1920
1994
|
os.makedirs("plain")
|
|
1921
1995
|
with open("plain/main.tex", "w") as f:
|
|
@@ -1932,7 +2006,15 @@ def test_to_dvc_latex_component_deps(tmp_dir):
|
|
|
1932
2006
|
)
|
|
1933
2007
|
# Compiling for a run or check maps the components in, kept out of Git,
|
|
1934
2008
|
# with one stage building each PDF, as DVC requires
|
|
1935
|
-
for name in [
|
|
2009
|
+
for name in [
|
|
2010
|
+
"build-paper-wdir",
|
|
2011
|
+
"maps",
|
|
2012
|
+
"sweep",
|
|
2013
|
+
"build-extra",
|
|
2014
|
+
"export",
|
|
2015
|
+
"render",
|
|
2016
|
+
"plots",
|
|
2017
|
+
]:
|
|
1936
2018
|
del ck_info["pipeline"]["stages"][name]
|
|
1937
2019
|
del ck_info["pipeline"]["stages"]["build-plain"]
|
|
1938
2020
|
with open("figures/plot.png", "wb") as fb:
|
|
@@ -20,7 +20,7 @@ calkit/install.py,sha256=y3-ZUZt1Tf3H9mP5v8dXtrNnhx7NiJPolF9ptlWRUkk,16997
|
|
|
20
20
|
calkit/invenio.py,sha256=i3UrEkzWXw4buhVwgjpLJL4AierBYnyWJCg0ytLuaBo,6214
|
|
21
21
|
calkit/julia.py,sha256=4GxUSItNXpYcRlCD9N8dLiuX44-HQaKFcuEudD8At1I,5640
|
|
22
22
|
calkit/jupyter.py,sha256=lE8kKmauHqspY7aPOiNpLGQyw9jSn4taGZScm6aR87I,1157
|
|
23
|
-
calkit/latex.py,sha256=
|
|
23
|
+
calkit/latex.py,sha256=lg7qle7pPvLe3SHfASTYHJNr3-tfATazrU-PR3W55qo,127114
|
|
24
24
|
calkit/licenses.py,sha256=3ZNBFxwRrfSjx3poG3G07z7GRCKAkdWiZ1AFe1yr8Gg,6853
|
|
25
25
|
calkit/magics.py,sha256=LrwJP7f84AHgKPSzmKmQjxRqzV_ATAUcpt6bHBdyDLQ,12151
|
|
26
26
|
calkit/markdown.py,sha256=3OwfOFQiXpf3KPMEwV8JLfwocdSwz50CA0IML2OKwts,106141
|
|
@@ -29,8 +29,8 @@ calkit/merge.py,sha256=X4wD0io79Lkt6B6HXZK1Puyz9TVqYMNzcnW53getfZk,22970
|
|
|
29
29
|
calkit/notebooks.py,sha256=guMNqW8lYoweNXsxqzbnM5kbHFCBcLTKpYroBh8bRp8,10393
|
|
30
30
|
calkit/office.py,sha256=mZqCxkIsmWthBAeJZ5SiGe21fn5zD2zXsy1E6nQIpWE,1291
|
|
31
31
|
calkit/ops.py,sha256=lLlZAFeplU8uLeMavr99d__Iof-YYwKijus74WfLipk,854
|
|
32
|
-
calkit/overleaf.py,sha256=
|
|
33
|
-
calkit/pipeline.py,sha256=
|
|
32
|
+
calkit/overleaf.py,sha256=KQjK_jL52PJP-XOOqYwEyKAyYEbAGeImZcGBowAxzMA,88489
|
|
33
|
+
calkit/pipeline.py,sha256=7iNk_y1B35Ps_xYDDkSlENh3C-0aVSC5PqvZI7z_atY,156511
|
|
34
34
|
calkit/procedures.py,sha256=ZZtoWWmq_H0dyuUb6M-g_y77GRsJzxLMovT_X0RtYrM,2860
|
|
35
35
|
calkit/provenance.py,sha256=pMlz6su2hrGVX8fdgLf0MoBr_XvpF2tlqHSXAM9VpIE,43464
|
|
36
36
|
calkit/questions.py,sha256=zi_rWQfOzlm1_bj3nScaWbQ5V79PsDcSCaRbKr-OXUY,78674
|
|
@@ -61,12 +61,12 @@ calkit/cli/new.py,sha256=Rw1IqFhjUfhOMbFU9jiecJprEkjxJ9gEmFmuekC7kBc,160898
|
|
|
61
61
|
calkit/cli/notebooks.py,sha256=aR4I0qatOtkrAxEG5PVLej20SBLKo8qr-lxDSzgljUQ,38836
|
|
62
62
|
calkit/cli/office.py,sha256=jVSTvbl91TCzlglST5O2b8hdApZA_QHw_UiEQFJqxdc,1754
|
|
63
63
|
calkit/cli/overleaf.py,sha256=CqCJRem9vPNHGmP1qd2aH0jAsSGR93Y-hom06Nn2gjI,59762
|
|
64
|
-
calkit/cli/scheduler.py,sha256=
|
|
64
|
+
calkit/cli/scheduler.py,sha256=seYEyTKJfM6-P7wnBWSV1_OF8cGej9yLJ5yjSs0bg20,62035
|
|
65
65
|
calkit/cli/show.py,sha256=66jjHIn_nSZo2yN9gM_W2gXv8Vb-yVzyaKYBbzxGo0M,20403
|
|
66
66
|
calkit/cli/sync.py,sha256=o6EnwADaUUK1yudWTc0gllKNLYD54jJbMnYBIuG5SfY,12643
|
|
67
67
|
calkit/cli/update.py,sha256=GZmXF_f8ECI2zV2Cd9UBh5vVdMXcJnP1JN52mA1uR_s,87813
|
|
68
68
|
calkit/cli/main/__init__.py,sha256=qu1POZPyqs33ZKfasOxv_Wc-EzVcEgK3Dt_vwFL8Bi8,65
|
|
69
|
-
calkit/cli/main/core.py,sha256=
|
|
69
|
+
calkit/cli/main/core.py,sha256=UC87pydQrfp4b4FlBCoeN_hDLXl9qz8aZylr6pgMKIw,221074
|
|
70
70
|
calkit/cli/main/xr.py,sha256=Ps34QNiPYGe4oRWfd25D5dyJrELyMbL4rMKUeQfQasg,38038
|
|
71
71
|
calkit/dvc/__init__.py,sha256=-B6tilCb_jw7QFmJ2srILez24wDhNKUzIBhZUMt01dE,381
|
|
72
72
|
calkit/dvc/core.py,sha256=i3SIWjmVd6rdzy9RavcIfNqjdMVDi8-RVm7erxLXVsQ,63094
|
|
@@ -79,7 +79,7 @@ calkit/models/core.py,sha256=-MM_NJP3Wvc6quR8PM_cvl_bY7xqmSxPmPxck7GvPvs,87951
|
|
|
79
79
|
calkit/models/docx.py,sha256=pVfBSmb2pfe-AeDYhJuYCvGohE98ixDuBBbkmtDyOMU,2897
|
|
80
80
|
calkit/models/io.py,sha256=CFprJHNGlxJneCyWg66N4wirOTiY2GEv2q5JGkROHkY,9370
|
|
81
81
|
calkit/models/iteration.py,sha256=ucCf1A5TuonLzP2Rd7ypKewss_ciDeTbUyYfSlFSBl4,2960
|
|
82
|
-
calkit/models/pipeline.py,sha256=
|
|
82
|
+
calkit/models/pipeline.py,sha256=OD6zW53AcWrf1ZTShvlKrHY-7hUTciauVZZGxRDmrQQ,126811
|
|
83
83
|
calkit/models/requirements.py,sha256=fp9V9PLau5qK8KrXXL0okubB_CFuBkHXo9cr1O6JAnQ,9447
|
|
84
84
|
calkit/resources/README.md,sha256=ANDi1MB76GFRtSYnBswmfjjhUjjaeaCjr17voayP4lI,1542
|
|
85
85
|
calkit/resources/__init__.py,sha256=QhDLrihdVQGyW2xEGzj2fIHGheq6Pn8W8jwlrjmmRv0,5122
|
|
@@ -136,8 +136,8 @@ calkit/tests/test_matlab.py,sha256=7yFKOYDCtxYIkRyFOwTIxlvzx03Pac0FKGIUT4Zx7zA,7
|
|
|
136
136
|
calkit/tests/test_merge.py,sha256=ddQbT3jKmiAXtbdXm4oJW5VVKCQrD5JvCcIiVo5Wp8M,6375
|
|
137
137
|
calkit/tests/test_models.py,sha256=SKzEGPF-M5BuWDMIJiJfkEnlgMdCkDKGkI8eGk1FNGE,16745
|
|
138
138
|
calkit/tests/test_notebooks.py,sha256=mqeMC_VaTdfMDxewuXlXEJDrZ_sdo4ZjbbOmQaBllF8,3822
|
|
139
|
-
calkit/tests/test_overleaf.py,sha256=
|
|
140
|
-
calkit/tests/test_pipeline.py,sha256=
|
|
139
|
+
calkit/tests/test_overleaf.py,sha256=GxOVlorbgvGy_pATQYF60e-eVyra95WlDOheHaTXuzM,23039
|
|
140
|
+
calkit/tests/test_pipeline.py,sha256=MTQSWlZJ7qmywSGTmCKsHpGlgJ9yzoFIsMnkMPBwRB0,195669
|
|
141
141
|
calkit/tests/test_procedures.py,sha256=NJUIDy-gkou1BBABeWjazm__-8ZxHwvzzjkLm6kbviI,11359
|
|
142
142
|
calkit/tests/test_provenance.py,sha256=7G5nDECsst-fzuAaEcKTemMkrlSQ7oUjEGUgZr8CoFw,31205
|
|
143
143
|
calkit/tests/test_questions.py,sha256=ZtXWAWpbZxsRZRPfdJWz34iBhCG3x3LGJVn8htOd57s,54022
|
|
@@ -167,7 +167,7 @@ calkit/tests/cli/test_list.py,sha256=TOVjZjHX3t5zEDLchtQJVDeDOQfBTogDScSiqJKRo1U
|
|
|
167
167
|
calkit/tests/cli/test_new.py,sha256=QNoIaFjwLtKR7InexeyuNq0mUJ62KBDS9_lmWCnS3Tc,78719
|
|
168
168
|
calkit/tests/cli/test_notebooks.py,sha256=FkD2HD9kveyKuXU55MgHoYyTnOGNzS-FtFIdVtMHzkc,12270
|
|
169
169
|
calkit/tests/cli/test_overleaf.py,sha256=hm1GdqCL-0vhC1ODhO7sBL06iZSgXvs-ssJ6qIldFSA,89315
|
|
170
|
-
calkit/tests/cli/test_scheduler.py,sha256=
|
|
170
|
+
calkit/tests/cli/test_scheduler.py,sha256=awXywKR71stY9iLFz5D_7uLWeSw3pH1602W6XG-_ft8,31416
|
|
171
171
|
calkit/tests/cli/test_show.py,sha256=nlD1hVYE5x6ksths0U-EPDt2gidI2lfgpHsl57KxleA,12796
|
|
172
172
|
calkit/tests/cli/test_sync.py,sha256=K8FbLq0PPE_JJmYRdXxlWcMx7IAAo-VjiVsfIPj-aYI,4811
|
|
173
173
|
calkit/tests/cli/test_update.py,sha256=Q4RW3plMbFNh-5PT9UQDpX3fAiE5efhbZ8myhbHmxvY,43235
|
|
@@ -191,24 +191,25 @@ calkit/agent_skills/add-pipeline-stage/SKILL.md,sha256=kpYYb-rJsS4B9p1Ub3gL21irC
|
|
|
191
191
|
calkit/agent_skills/build-paper-pipeline/SKILL.md,sha256=KtPt-yzjL7LfQd4TKR-i82L_SCs8lgDjNkRc28HuL2Q,6832
|
|
192
192
|
calkit/agent_skills/check-questions/SKILL.md,sha256=4bGDC2ONgRIEY7tP54ciOhcFlgq6_3L6nXtQxP2bH3Q,12887
|
|
193
193
|
calkit/agent_skills/check-reproducibility/SKILL.md,sha256=5SGmtnbq8bSJW0Zwav_aVzfuhilHwBkkdxGuZvPHxGU,4699
|
|
194
|
+
calkit/agent_skills/connect-overleaf-project/SKILL.md,sha256=6yV41FK4oh0dknBjP6nc8MOFKTrbfYKEVzak8c-anew,5962
|
|
194
195
|
calkit/agent_skills/conventions/SKILL.md,sha256=bIPrDy5l7aa6Al7USYNxV-OoTJPTm9MxrzO61GCOtuE,10701
|
|
195
196
|
calkit/agent_skills/create-pipeline/SKILL.md,sha256=SwDBMEzVtN7HkFT2gmQ0neI5XYI0950Ae1xmhrzmbkk,5491
|
|
196
197
|
calkit/agent_skills/resolve-merge-conflicts/SKILL.md,sha256=EHOZDTV8sjeSzCll_khvAx7LigYLhhKaTghAS8G1q5Q,2874
|
|
197
|
-
calkit_python-0.50.
|
|
198
|
-
calkit_python-0.50.
|
|
199
|
-
calkit_python-0.50.
|
|
200
|
-
calkit_python-0.50.
|
|
201
|
-
calkit_python-0.50.
|
|
202
|
-
calkit_python-0.50.
|
|
203
|
-
calkit_python-0.50.
|
|
204
|
-
calkit_python-0.50.
|
|
205
|
-
calkit_python-0.50.
|
|
206
|
-
calkit_python-0.50.
|
|
207
|
-
calkit_python-0.50.
|
|
208
|
-
calkit_python-0.50.
|
|
209
|
-
calkit_python-0.50.
|
|
210
|
-
calkit_python-0.50.
|
|
211
|
-
calkit_python-0.50.
|
|
212
|
-
calkit_python-0.50.
|
|
213
|
-
calkit_python-0.50.
|
|
214
|
-
calkit_python-0.50.
|
|
198
|
+
calkit_python-0.50.5.data/data/etc/jupyter/jupyter_server_config.d/calkit.json,sha256=CWrZP--JDGz8fsvbAlKr_duTL1vDriGT48SL1YCtkY0,81
|
|
199
|
+
calkit_python-0.50.5.data/data/share/jupyter/labextensions/calkit/package.json,sha256=0hnHqhCly59Wg7urFGahc2mSupCWwiPfwKWCYfnbB2E,6202
|
|
200
|
+
calkit_python-0.50.5.data/data/share/jupyter/labextensions/calkit/schemas/calkit/package.json.orig,sha256=egkbkHmJYzDARH3_4qpoF75_Svpj_dfPaIwRU-PNjW4,6064
|
|
201
|
+
calkit_python-0.50.5.data/data/share/jupyter/labextensions/calkit/schemas/calkit/plugin.json,sha256=YSpIrwpwB-lQBk9Mwv-npedWTOOZreO6nlWZhqlWyGI,840
|
|
202
|
+
calkit_python-0.50.5.data/data/share/jupyter/labextensions/calkit/static/506.c34b070098184e33.js,sha256=0PxdmgdZvLeh6RBcfgN1pcriNO8oCeTK5WJvUIEA3MY,112384
|
|
203
|
+
calkit_python-0.50.5.data/data/share/jupyter/labextensions/calkit/static/57d13a7399cec3c5.png,sha256=svHD7-cMtTnRITFwugwsVaB9nZ-h8A61ose8z32HiRE,24850
|
|
204
|
+
calkit_python-0.50.5.data/data/share/jupyter/labextensions/calkit/static/616.528427eb54a4a0c0.js,sha256=d0rHq7cqAjj1GNAMLOpl8dyY8yyKUQcLPCOUr-wJGdQ,8129
|
|
205
|
+
calkit_python-0.50.5.data/data/share/jupyter/labextensions/calkit/static/740.6bf87276e9e5788a.js,sha256=4E0sK8x-ldVkL-1sM07wgJGS1vtVD9Uly7VtoFTi23c,221
|
|
206
|
+
calkit_python-0.50.5.data/data/share/jupyter/labextensions/calkit/static/899.f9b9f9bf705a6493.js,sha256=RNTIItG9k-A_Ip54fRR3QMCjiffkY0bo8zQ2Xh7TyOY,57096
|
|
207
|
+
calkit_python-0.50.5.data/data/share/jupyter/labextensions/calkit/static/935.46ecc6bf99aa593a.js,sha256=Cmp0KWM5YDZ-zcsJWWgqCMIF6adeHQH80rxz1sas45E,51183
|
|
208
|
+
calkit_python-0.50.5.data/data/share/jupyter/labextensions/calkit/static/remoteEntry.109a3a8379365e59.js,sha256=4JavPLcn703qVSC2E1_MD1thrJNL4N-eITjnfNhSDSM,15066
|
|
209
|
+
calkit_python-0.50.5.data/data/share/jupyter/labextensions/calkit/static/style.js,sha256=LTlA3M58hwjqmhomdcrNRO9GM58zZcf0V76WX9HI6EQ,146
|
|
210
|
+
calkit_python-0.50.5.data/data/share/jupyter/labextensions/calkit/static/third-party-licenses.json,sha256=2BGdItLJwO3fAopLl4eJvp26TEwuscYC0-yFaF-LaLU,13683
|
|
211
|
+
calkit_python-0.50.5.dist-info/METADATA,sha256=Ac83u1P6wwwizJJWqJzr_nvtkSfaY0a4Wb8kUr70-p0,24944
|
|
212
|
+
calkit_python-0.50.5.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
213
|
+
calkit_python-0.50.5.dist-info/entry_points.txt,sha256=TtpHpcv2vFVAVYxFVp0XrwCV_z7FWIOguEiypXRDoOw,131
|
|
214
|
+
calkit_python-0.50.5.dist-info/licenses/LICENSE,sha256=9ZamCaSUTZk9rcrnf-sWFKLOHr3ws-S_dgKMegW4nw8,1056
|
|
215
|
+
calkit_python-0.50.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|