docs: add marimo notebooks to the companion book - #15
Merged
Conversation
Three self-contained marimo notebooks under book/marimo/notebooks/, exported
to docs/notebooks/*.html by `make book` and linked from a new Notebooks nav
section, following the jquantstats layout:
- 01_active_set_methods: the active-set / block-principal-pivoting loop for
min_{x>=0} 1/2 x'Ax - b'x — KKT/LCP conditions, the reduced free-set solve,
the primal/dual violator tests, and the least-index Bland fallback that
guarantees finite termination. Interactive solve with a free-set trajectory.
- 02_equality_constraints: solve_nnqp vs solve_nnqp_eq — the multiplier, the
saddle system, the p-by-p Schur complement, the shifted reduced gradient,
and the p=1 simplex/budget case.
- 03_test_problems: documents tests/problems.py — the plant-a-known-optimum
recipe, make_problem, make_eq_problem, make_adversarial (forces the
fallback), and make_scaled_problem (CG vs Jacobi-PCG).
Each notebook carries a PEP 723 header with a local editable nncg source so
`marimo export html --sandbox` resolves the package. marimo is added to the
dev dependency group so `uv run marimo` in the synced _book-notebooks target
resolves.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds three self-contained Marimo notebooks to the project’s companion MkDocs book, including wiring them into the site navigation and ensuring the book build can export the notebooks to standalone HTML.
Changes:
- Add
marimo>=0.18.0to thedevdependency group (and lockfile) so the book’s notebook export tooling resolves. - Add a new Notebooks section to
mkdocs.ymlthat links the exported HTML pages. - Introduce three new Marimo notebook scripts under
book/marimo/notebooks/.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Locks marimo and its transitive dependencies; updates dev metadata to include the dev group. |
pyproject.toml |
Adds marimo>=0.18.0 to the dev dependency group used by the book build. |
mkdocs.yml |
Adds a Notebooks nav section linking to exported HTML notebook artifacts. |
book/marimo/notebooks/01_active_set_methods.py |
New Marimo notebook documenting the active-set/BPP/Bland fallback path. |
book/marimo/notebooks/02_equality_constraints.py |
New Marimo notebook documenting the equality-constraint (Schur complement) solver path. |
book/marimo/notebooks/03_test_problems.py |
New Marimo notebook documenting/using test problem generators and solver behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+70
to
+76
| _here = Path.cwd() | ||
| for _cand in (_here, *_here.parents): | ||
| if (_cand / "tests" / "problems.py").exists(): | ||
| if str(_cand) not in sys.path: | ||
| sys.path.insert(0, str(_cand)) | ||
| break | ||
|
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…b dev dep Drop the sys.path hack and `from tests.problems import ...` in 03_test_problems.py — the four generators are now inlined verbatim so the notebook is self-contained (clears deptry DEP001 'tests'). Add matplotlib to the dev dependency group so the notebooks' plotting import is declared (clears DEP001 'matplotlib' across all three notebooks). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three self-contained marimo notebooks under
book/marimo/notebooks/, wired into the companion book (exported todocs/notebooks/*.htmlbymake bookand linked from a new Notebooks nav section). Layout follows thejebel-quant/jquantstatsconvention.min_{x≥0} ½x'Ax − b'x: KKT/LCP conditions, the reduced free-set solve, the primal/dual violator tests, and the least-index Bland fallback that guarantees finite termination. Interactive solve with a free-set trajectory heatmap.solve_nnqpvssolve_nnqp_eq: the multiplier λ, the saddle system, the p×p Schur complement, the shifted reduced gradients = Ax − b − Bᵀλ, and the p=1 simplex/budget case with a live slider.tests/problems.py: the plant-a-known-optimum recipe,make_problem,make_eq_problem,make_adversarial(forces the fallback — 19/40 seeds), andmake_scaled_problem(CG vs Jacobi-PCG).How it hooks into the build
[tool.uv.sources] nncg = { path = "../../..", editable = true }, so the synced_book-notebookstarget (marimo export html --sandbox) resolves the local package. Notebook 03 locates the repo root at runtime so itstests.problemsimport works under the sandbox cwd.marimo>=0.18.0added to thedevdependency group (which is indefault-groups) souv run marimoresolves — the emptydevgroup would otherwise breakmake book.mkdocs.yml: newNotebooksnav section.Verification
make bookbuilds end-to-end; all three notebooks export and appear in_book/notebooks/and the nav.marimo export html --sandbox(the exact book path).ruff checkandruff format --checkpass; full pre-commit hook suite green.🤖 Generated with Claude Code