Skip to content

Commit d7278c4

Browse files
committed
📚 tutorials: fix copy-paste run blockers
Address the copy-paste self-containment audit, a reader who pastes cells into their own notebook hit avoidable failures. - install notes: add matplotlib (the 7 plotting modules) and gsrd (all modules), plus a Graphviz `dot` note. These live in the build venv's extras, so CI was green while a documented `uv pip install` was not. - module1: replace `!tree` (absent by default on macOS/minimal Linux/Windows) with a portable pure-Python directory listing. - module5: guard the empty-DB case so it raises an actionable message ("run Module 2 first") instead of a cryptic `zip()` ValueError. - module6b: un-hide the `pipeline_with_optional_fft` cell (was hide-input) so a copy-paste reader can see the code a later visible cell depends on.
1 parent 2a4ae6f commit d7278c4

9 files changed

Lines changed: 25 additions & 15 deletions

File tree

‎docs/source/tutorials/module1.md‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ After this module, you will be able to:
3838
This module needs AiiDA and `aiida-shell`:
3939

4040
```bash
41-
uv pip install aiida-core aiida-shell
41+
uv pip install aiida-core aiida-shell matplotlib git+https://github.com/aiidateam/gsrd
4242
```
4343

44-
It also uses the small `gsrd` simulator introduced in {ref}`Module 0 <tutorial:module0>`.
44+
It also uses the small `gsrd` simulator introduced in {ref}`Module 0 <tutorial:module0>`, and the Graphviz `dot` binary for the provenance-graph plots (`apt install graphviz`, `brew install graphviz`, or `conda install graphviz`).
4545
:::
4646

4747
## Setting up your AiiDA profile
@@ -322,8 +322,13 @@ AiiDA stores everything in its internal database and file repository (efficient
322322
```
323323

324324
```{code-cell} ipython3
325-
# Show the directory tree of the dumped calculation data.
326-
!tree /tmp/aiida-tutorial/dump
325+
# Show the directory tree of the dumped data (pure Python, no `tree` binary needed).
326+
from pathlib import Path
327+
328+
dump_dir = Path('/tmp/aiida-tutorial/dump')
329+
for path in sorted(dump_dir.rglob('*')):
330+
indent = ' ' * (len(path.relative_to(dump_dir).parts) - 1)
331+
print(f'{indent}{path.name}{"/" if path.is_dir() else ""}')
327332
```
328333

329334
All the relevant entities of the calculation are there: the input file, the simulation script, the submission script, captured stdout and stderr, and AiiDA metadata.

‎docs/source/tutorials/module2.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ After this module, you will be able to:
4949
Same requirements as {ref}`Module 1 <tutorial:module1>`:
5050

5151
```bash
52-
uv pip install aiida-core aiida-shell
52+
uv pip install aiida-core aiida-shell matplotlib git+https://github.com/aiidateam/gsrd
5353
```
5454
:::
5555

‎docs/source/tutorials/module3a.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Running that workflow over *many* inputs, replacing the Python `for`-loop, is th
5151
This module uses `aiida-core`, `aiida-shell`, and `aiida-workgraph`. Install them with:
5252

5353
```bash
54-
uv pip install aiida-core aiida-shell aiida-workgraph
54+
uv pip install aiida-core aiida-shell aiida-workgraph matplotlib git+https://github.com/aiidateam/gsrd
5555
```
5656

5757
`aiida-workgraph` is currently a separate package; it is planned to become part of `aiida-core` with the v3.0 release.

‎docs/source/tutorials/module3b.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ After this module, you will be able to:
4141
This module uses AiiDA, `aiida-shell`, and `aiida-workgraph`:
4242

4343
```bash
44-
uv pip install aiida-core aiida-shell aiida-workgraph
44+
uv pip install aiida-core aiida-shell aiida-workgraph matplotlib git+https://github.com/aiidateam/gsrd
4545
```
4646
:::
4747

‎docs/source/tutorials/module4.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ After this module, you will be able to:
4949
This module uses AiiDA and `aiida-shell`, plus SSH access to a cluster:
5050

5151
```bash
52-
uv pip install aiida-core aiida-shell
52+
uv pip install aiida-core aiida-shell git+https://github.com/aiidateam/gsrd
5353
```
5454
:::
5555

‎docs/source/tutorials/module5.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ After this module, you will be able to:
4040
This module only needs AiiDA:
4141

4242
```bash
43-
uv pip install aiida-core
43+
uv pip install aiida-core aiida-shell matplotlib git+https://github.com/aiidateam/gsrd
4444
```
4545

4646
It reuses the sweep data created in {ref}`Module 2 <tutorial:module2>`.
@@ -350,6 +350,13 @@ qb = (
350350
)
351351
)
352352
rows = sorted(qb.all())
353+
if not rows:
354+
msg = (
355+
'No F-sweep data found in this profile. Module 5 queries the data that '
356+
'Module 2 creates, run Module 2 first so this shared tutorial profile has '
357+
'data to query.'
358+
)
359+
raise RuntimeError(msg)
353360
f_values, variances = zip(*rows)
354361
355362
plot_transition_curve(list(f_values), list(variances))

‎docs/source/tutorials/module6a.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Composing these into a workflow whose shape **emerges at runtime** (an `If` insi
3737
This module uses AiiDA, `aiida-shell`, and `aiida-workgraph`:
3838

3939
```bash
40-
uv pip install aiida-core aiida-shell aiida-workgraph
40+
uv pip install aiida-core aiida-shell aiida-workgraph matplotlib git+https://github.com/aiidateam/gsrd
4141
```
4242
:::
4343

‎docs/source/tutorials/module6b.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ After this module, you will be able to:
3535
This module uses AiiDA, `aiida-shell`, and `aiida-workgraph`:
3636

3737
```bash
38-
uv pip install aiida-core aiida-shell aiida-workgraph
38+
uv pip install aiida-core aiida-shell aiida-workgraph matplotlib git+https://github.com/aiidateam/gsrd
3939
```
4040
:::
4141

@@ -82,11 +82,9 @@ BASE_PARAMS = {
8282
F_VALUES = [0.038, 0.040, 0.042, 0.044, 0.046, 0.050, 0.055, 0.060]
8383
```
8484

85-
We also reuse `pipeline_with_optional_fft` from {ref}`Module 6a <tutorial:module6a>`, repeated here (folded) so this notebook runs standalone:
85+
We also reuse `pipeline_with_optional_fft` from {ref}`Module 6a <tutorial:module6a>`, repeated here so this notebook runs standalone:
8686

8787
```{code-cell} ipython3
88-
:tags: [hide-input]
89-
9088
# The If-gated pipeline from Module 6a: run the pipeline, then run the FFT
9189
# only if the run's variance clears a threshold.
9290
@task.graph()

‎docs/source/tutorials/module7.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This module is a survey, not a deep dive: each section is a concrete demo or ske
4040
This module touches AiiDA, `aiida-shell`, and `aiida-workgraph`:
4141

4242
```bash
43-
uv pip install aiida-core aiida-shell aiida-workgraph
43+
uv pip install aiida-core aiida-shell aiida-workgraph git+https://github.com/aiidateam/gsrd
4444
```
4545

4646
Install `aiida-core`, not `aiida` (the latter is an old meta-package).

0 commit comments

Comments
 (0)