Skip to content

Tutorial Notebook Bug Fix + Notebook CI Flow + Merging 5T-OTA Example #87, 92 #95

Merged
msaligane merged 8 commits into
ReaLLMASIC:mainfrom
AL-255:main
May 28, 2026
Merged

Tutorial Notebook Bug Fix + Notebook CI Flow + Merging 5T-OTA Example #87, 92 #95
msaligane merged 8 commits into
ReaLLMASIC:mainfrom
AL-255:main

Conversation

@AL-255
Copy link
Copy Markdown
Contributor

@AL-255 AL-255 commented May 28, 2026

Recent repo changes like folder rearrangement break some tutorial notebooks. This PR fixes those issues and added a CI flow. Now all the notebooks should run end-to-end without error.

Summary

  • Fixes every notebook under tutorial/ so the full suite (12 notebooks) executes end-to-end. Verified in both a bare conda env and inside hpretl/iic-osic-tools — see tutorial/HOW_TO_RUN.md for the env-var contract and the venv workaround for iic-osic-tools' Python 3.12 + gdsfactory 9.x.
  • Adds .github/workflows/notebooks.yml, runs in parallel with Cell DRC on every push/PR. Uses the same iic-osic-tools container + uv + Python 3.10 venv pattern as drc.yml.
  • Adds a sub-second cleared-outputs precheck (tests/notebooks/check_outputs_cleared.py) that fails the CI before the multi-minute nbconvert pass if any notebook ships with stale execution_count / cell outputs. --fix mode strips in place.
  • Two source-side fixes that unblock the tutorials and are CI-neutral against existing DRC/LVS:
    • gf180.drc() was broken because gf180mcu_drc.lydrc referenced drc/rule_decks/*.drc fragments that aren't bundled in the package. Routed through a tiny wrapper deck that bridges klayout >0.29 -rd var names and loads the standalone gf180mcu.drc instead.
    • MappedPDK.lvs_netgen now invokes netgen via bash $(which netgen). The netgen wrapper ships with #!/bin/sh but uses bashisms (${i//\"/\\\"}) that explode under dash (/bin/sh on Ubuntu).
  • Notebook-content fixes:
    • GLayout_Cells / glayout_opamp: updated stale import paths (glayout.elementary, glayout.flow.*) to the current glayout.cells.elementary / glayout.cells.composite.opamp.opamp. Dropped opamp's RL/sky130_nist_tapeout/gen_spec/model/eval cells (those live in OpenFASOC, not this repo) and replaced them with a markdown pointer.
    • INV_part2: added missing from gdsfactory import Component, replaced the broken inv_netlist cell with a working version, populated the empty LVS/PEX placeholder cells, removed the comp HTML-repr cell that needed layer_views the PDK doesn't provide.
    • FVF/INV part-1 writer cells now drop helpers in tutorial/{FVF,INV}/ (self-contained) instead of ../../{FVF,INV}/ (outside the repo). INV writer also stashes fet_P/fet_N on top_level.info so part-2's netlist generator can find them.
    • BJT tutorials no longer hardcode /foss/designs — use Path.cwd() so they work in both envs.
    • Every PDK-touching notebook starts with a unified env bootstrap that sources ~/.bashrc (for iic-osic-tools), uses setdefault so caller-exported vars always win, and derives PDKPATH=$PDK_ROOT/$PDK when missing.
  • .gitignore: re-includes .github/ (the pre-existing .*/ rule was hiding new workflow files), ignores tutorial-time scratch (tutorial/FVF, tutorial/INV, tutorial/ext, scratch GDS/SVG/lyrdb, magic extract dirs, notebook_results/).

DharmaAnargyaJowandy and others added 8 commits April 28, 2026 18:21
In this part 2 5T OTA tutorial notebook, we did LVS, PEX, and post layout simulation. Only LVS is finished, the others are still not finished. This cell is already DRC and LVS clean
Tutorial state was a mix of broken imports (glayout.elementary, glayout.flow),
missing PDK env-var handling, hardcoded /foss/designs paths, and a shipping
defect in the gf180 DRC deck. After the fixes the same 12 notebooks pass
under both a bare conda env and inside hpretl/iic-osic-tools.

Source fixes (CI-neutral — DRC/LVS results unchanged):
* gf180_mapped: route gf180.drc() through a tiny wrapper deck that bridges
  klayout>0.29 -rd var names and loads the bundled standalone gf180mcu.drc,
  replacing the broken gf180mcu_drc.lydrc that referenced unbundled
  drc/rule_decks/*.drc fragments
* mappedpdk: invoke netgen via `bash $(which netgen)` so the wrapper's
  `#!/bin/sh` + bashisms don't blow up under dash

Notebook fixes:
* import paths updated to current glayout layout (cells/elementary,
  cells/composite/opamp) in GLayout_Cells + glayout_opamp
* glayout_opamp: drop external-OpenFASOC RL/tapeout cells (sky130_nist_tapeout,
  gen_spec, model, eval), replace with a pointer to that repo, keep the
  layout-generation flow
* INV_part2: add missing `from gdsfactory import Component`, replace broken
  inv_netlist cell, populate empty LVS/PEX placeholder cells, replace the
  `comp` HTML-repr cell that needed layer_views the PDK doesn't provide
* FVF/INV part1: writer cells now drop helpers in tutorial/{FVF,INV}/ instead
  of ../../{FVF,INV}/; INV writer stashes fet_P/fet_N on top_level.info so
  part2's netlist generator can find them
* BJT tutorials: drop /foss/designs hardcoding, use Path.cwd() instead
* every PDK-touching notebook now starts with a unified env bootstrap that
  sources ~/.bashrc (for iic-osic-tools), uses setdefault so caller-exported
  vars always win, and derives PDKPATH=$PDK_ROOT/$PDK when missing
* HOW_TO_RUN.md documents both the iic-osic-tools venv workaround
  (gdsfactory 7.x venv shadowing the image's 9.x) and the bare-conda flow

CI:
* new notebooks.yml workflow runs in parallel with drc.yml on push/PR,
  exercises every tutorial/**/*.ipynb via jupyter nbconvert, emits
  summary.json + junit.xml in the same shape as run_cell_drc.py
* tests/notebooks/run_tutorial_notebooks.py is the runner; sorts so
  part1 notebooks execute before part2 (helper-module dependency)
* .gitignore re-includes .github/ since the pre-existing `.*/` rule was
  swallowing new workflow files; also ignores tutorial-time scratch
  (helpers, GDS, SVGs, lyrdb, magic ext dirs)
Adds tests/notebooks/check_outputs_cleared.py — a stdlib-only precheck that
flags any code cell shipping with execution_count != None or non-empty
outputs. notebooks.yml now runs this right after checkout, before the
nbconvert step, so a contributor who forgets to clear outputs fails CI in
under a second instead of waiting through the ~3 min execution pass.

The script also has a --fix mode that strips outputs in-place, mirroring
`jupyter nbconvert --clear-output --inplace`, for use as a local pre-push
hook.
Pulls in the 5T OTA tutorial part 1 + part 2 notebooks from
DharmaAnargyaJowandy:5T_OTA (ReaLLMASIC#87).

The upstream PR shipped part 2 with non-cleared cell outputs (execution_count
and output blobs from a local run); stripped in-place during the merge with
`check_outputs_cleared.py --fix` so the new cleared-outputs CI precheck
passes. Both notebooks executed end-to-end inside iic-osic-tools via our
notebook CI runner (~14s and ~24s respectively).

Original commits:
  ba50d36 fix: Connect Dummy to tapring
  4f6300c feat: add 5T OTA Tutorial Part 2
  8b8ce9e feat: add 5T OTA Tutorial
…aLLMASIC#87's part 2)

PR ReaLLMASIC#92 (AdrianSPratama:main) and PR ReaLLMASIC#87 (DharmaAnargyaJowandy:5T_OTA) both
add `tutorial/glayout_tutorial_5T_OTA_part2.ipynb` with different content —
this is an add/add conflict. Resolved by taking ReaLLMASIC#92's version, which is the
more thorough notebook (24 cells vs 15, includes a PEX section, more
markdown explanation of the LVS/PEX/sim flow). Part 1 from ReaLLMASIC#87 stays.

Both 5T_OTA notebooks pass the cleared-outputs precheck and execute end-to-end
in iic-osic-tools via run_tutorial_notebooks.py (part1 12.8s, part2 37.5s).

Original commit:
  c334af5 feat part 2 of 5T OTA tutorial notebook
@AL-255
Copy link
Copy Markdown
Contributor Author

AL-255 commented May 28, 2026

@msaligane Hi Mehdi, Let's merge this as soon as possible for the upcoming Chipathon

@msaligane msaligane merged commit 36bb8df into ReaLLMASIC:main May 28, 2026
3 checks passed
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.

4 participants