Simplify notebook setup

This commit is contained in:
Andras Schmelczer 2026-10-28 22:34:22 +00:00
commit 13dadc74ed

View file

@ -8,7 +8,8 @@
"\n",
"Use Python 3.12 or 3.13 and install this checkout with `uv pip install --editable '.[notebooks]'`.\n",
"See **Run notebooks locally** in the repository README for the kernel, execution order,\n",
"and full-data options. Generated artifacts stay under `.cache/notebooks/`.\n"
"and full-data options. Run related notebooks from the same working directory\n",
"to share the default `.cache/` model store and `tracing_database.json` database.\n"
],
"metadata": {}
},
@ -18,23 +19,7 @@
"metadata": {},
"execution_count": null,
"source": [
"import os\n",
"import sys\n",
"from pathlib import Path\n",
"\n",
"# Works when opened from the repository root or any notebook directory.\n",
"_start = Path(globals().get(\"__file__\", Path.cwd())).resolve()\n",
"ROOT = next(\n",
" p\n",
" for p in [_start, *_start.parents]\n",
" if (p / \"pyproject.toml\").is_file() and (p / \"great_ai\").is_dir()\n",
")\n",
"sys.path.insert(0, str(ROOT / \"docs\"))\n",
"from notebook_support import setup_notebook, mag_lines\n",
"\n",
"FULL_RUN = os.environ.get(\"GREAT_AI_NOTEBOOK_FULL\") == \"1\"\n",
"WORK_DIR = setup_notebook(ROOT, \"surveys\")\n",
"DATA_DIR = ROOT / \"docs/tutorial/data\""
"from docs.notebook_support import SURVEY_DIR"
],
"outputs": []
},
@ -46,7 +31,6 @@
"source": [
"import pandas as pd\n",
"\n",
"SURVEY_DIR = ROOT / \"docs/surveys\"\n",
"best_practices = pd.read_csv(SURVEY_DIR / \"Best practices assessment.csv\")\n",
"best_practices"
],
@ -161,7 +145,7 @@
")\n",
"plt.tight_layout()\n",
"\n",
"plt.savefig(WORK_DIR / \"best-practices.png\", dpi=150)\n",
"plt.savefig(\"best-practices.png\", dpi=150)\n",
"\n",
"stats.pearsonr(\n",
" [x for x, y in best_practice_score_se], [y for x, y in best_practice_score_se]\n",