Skip to content

Add jupytext for notebooks#473

Merged
vcharraut merged 11 commits into
emerge/temp_trainingfrom
vcha/jupytext
Jun 3, 2026
Merged

Add jupytext for notebooks#473
vcharraut merged 11 commits into
emerge/temp_trainingfrom
vcha/jupytext

Conversation

@vcharraut
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings June 3, 2026 08:35
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a Jupytext-based workflow for maintaining notebooks as version-controlled py:percent scripts, and adds automated execution of those notebooks in CI to catch regressions.

Changes:

  • Add a pytest-based notebook execution harness (jupytext + nbclient) and a dedicated GitHub Actions job to run it.
  • Add notebooks/jupytext.toml configuration and ignore generated .ipynb files under notebooks/.
  • Convert existing notebooks from .ipynb to Jupytext percent-format .py scripts (and remove the committed .ipynb versions).

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/notebooks/test_notebooks.py Adds pytest that executes numbered notebook scripts via Jupytext + nbclient.
notebooks/jupytext.toml Configures pairing of .ipynb and py:percent formats.
notebooks/01_observations.py Jupytext percent-format version of notebook 01.
notebooks/02_rewards.py Jupytext percent-format version of notebook 02.
notebooks/03_metrics.py Jupytext percent-format version of notebook 03.
notebooks/04_training.py Jupytext percent-format version of notebook 04.
notebooks/05_inference.py Jupytext percent-format version of notebook 05.
notebooks/06_architecture.py Jupytext percent-format version of notebook 06.
notebooks/01_observations.ipynb Removes committed .ipynb (generated artifact under new workflow).
notebooks/02_rewards.ipynb Removes committed .ipynb (generated artifact under new workflow).
notebooks/03_metrics.ipynb Removes committed .ipynb (generated artifact under new workflow).
notebooks/04_training.ipynb Removes committed .ipynb (generated artifact under new workflow).
notebooks/06_architecture.ipynb Removes committed .ipynb (generated artifact under new workflow).
notebooks/.gitignore Ignores generated .ipynb files in notebooks/.
.github/workflows/ci.yml Adds a dedicated CI job to execute the notebooks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml
Comment on lines +63 to +71
- name: Install pufferlib
env:
TMPDIR: ${{ runner.temp }}/build
PIP_NO_CACHE_DIR: 1
run: |
sudo apt-get update && sudo apt-get install -y build-essential cmake
python -m pip install -U pip pytest jupytext nbclient ipykernel
pip install -e . --no-cache-dir
python setup.py build_ext --inplace --force
Comment on lines +12 to +16
# Kernel runs headless from notebooks/ (05 loads ../weights/...); repo root on
# PYTHONPATH so `from notebooks.notebook_utils import ...` resolves.
os.environ["MPLBACKEND"] = "Agg"
os.environ["PYTHONPATH"] = os.pathsep.join(p for p in [str(REPO_ROOT), os.environ.get("PYTHONPATH", "")] if p)

Comment thread notebooks/05_inference.py
Comment on lines +702 to +705
for i, label in enumerate(ego_labels):
vals = all_ego[:, i]
print(f"{label}: mean={vals}")
axes[0, i].hist(vals, bins=60, edgecolor="black", alpha=0.7, color="steelblue")
@vcharraut vcharraut merged commit f09880b into emerge/temp_training Jun 3, 2026
12 checks passed
@vcharraut vcharraut deleted the vcha/jupytext branch June 3, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants