This page collects repository-facing instructions for building the book and running the notebooks locally.
This repository uses uv for Python environment management. The book build and
Python notebook tooling should be installed into the project virtual
environment, not into the root Python installation.
-
Create and sync the docs environment from the repository root:
uv sync --group docs
This creates a project-local
.venvand leaves the root Python installation unchanged. -
Confirm the Node.js toolchain used by Jupyter Book 2 is available:
node --version npm --version
-
Build the site from the repository root:
uv run --group docs jupyter book build --html --ci
The built site will be written to _build/html/index.html.
-
To work on the Python notebooks locally, install the notebook-specific dependencies into the same
uvenvironment:# For only the math programming notebooks: uv sync --group mathprog # For only the QUBO-related notebooks: uv sync --group qubo # To make both math programming and QUBO notebooks runnable together: uv sync --group mathprog --group qubo
Use
mathprogfor notebooks_py/1-MathProg_python.ipynb andqubofor notebooks_py/2-QUBO_python.ipynb plus the Julia notebooks that rely on the D-Wave Python stack: notebooks_jl/2-QUBO.ipynb, notebooks_jl/3-GAMA.ipynb, notebooks_jl/4-DWave.ipynb, and notebooks_jl/5-Benchmarking.ipynb. Those Julia notebooks reuse the repo-local Python environment instead of relying on Julia'sCondaPkgresolver. -
To prepare a Julia notebook environment locally, instantiate the notebook-specific project instead of a shared
notebooks_jlproject:make setup-julia NOTEBOOK=notebooks_jl/1-MathProg.ipynb make setup-julia NOTEBOOK=notebooks_jl/2-QUBO.ipynb
This instantiates only the Julia project that belongs to the selected notebook under
notebooks_jl/envs/<notebook-stem>/, so the math programming notebook no longer pays the D-Wave/QUBO dependency cost. -
To verify notebook execution locally, use the repo targets:
make verify-mathprog make verify-qubo-python
make verify-mathprogexecutes the Python and Julia math programming notebooks throughjupyter nbconvert, whilemake verify-qubo-pythonexecutes the Python QUBO notebook. Both write the executed copies to.nbverify/. The Julia notebook checks default to Julia1.11.5so they match the notebook manifests and the current Colab runtime; install it once withjuliaup add 1.11.5, or overrideJULIA=/path/to/juliaif you need a different compatible local binary. The verification flow keeps the Python package cache in.uv-cache/, so it does not depend on writing to a globaluvcache. Julia writes temporary package state to.julia-depot/while still reusing packages already available in~/.julia/.To verify a different set of notebooks, override
NOTEBOOKS:make verify-notebooks NOTEBOOKS="notebooks_py/2-QUBO_python.ipynb notebooks_jl/2-QUBO.ipynb"To approximate Google Colab's Julia runtime locally, first install Julia
1.11.5once withjuliaup add 1.11.5, then run the Colab-style Julia check:make verify-julia-colab
This target uses
COLAB_JULIAby default. If you setJULIA=/path/to/juliato a compatible binary on the command line, the Colab-style target will now reuse that binary unless you overrideCOLAB_JULIAexplicitly. You can also pick a specific juliaup toolchain withCOLAB_JULIA_VERSION=1.11.5. This target writes Julia state into.julia-colab-depot/1.11.5, reuses registries and cached packages from~/.juliawhen available, executes the Julia math programming and QUBO notebooks end to end, and runs import/bootstrap smokes for the remaining Julia notebooks. It is the recommended local check before changing the Julia notebook bootstrap or notebook-specific Julia environments.To force a colder check that does not fall back to
~/.julia, override the depot path explicitly:make verify-julia-colab COLAB_JULIA_DEPOT_PATH="$PWD/.julia-colab-depot/1.11.5"The Colab bootstrap now validates the running Julia patch version against the checked-in manifest before instantiating packages. If you intentionally want to allow a mismatch and accept a slower
Pkgre-resolve, setQUIP_ALLOW_JULIA_VERSION_MISMATCH=1before launching the notebook.If you need the Colab bootstrap to clone a non-default QuIP ref, set
QUIP_REPO_REF=<branch-tag-or-40-char-commit>before running the first Julia notebook cell.The default
make sysimagebuild now uses the sharednotebooks_jl/envs/sysimageproject so the release artifact covers the full notebook stack. To build a notebook-specific sysimage instead, passSYSIMAGE_NOTEBOOK=notebooks_jl/2-QUBO.ipynb.To install an optional git hook that runs this check when staged changes touch the Julia notebooks or their shared tooling, run:
make install-julia-colab-hook
The hook is a local
pre-commithook under.githooks/pre-commit. SetSKIP_JULIA_COLAB_HOOK=1for a one-off bypass. -
To run the notebooks interactively, install a generic QuIP Julia kernel and then launch Jupyter:
julia --project=./scripts -e 'import Pkg; Pkg.instantiate(); using IJulia; installkernel("QuIP Julia", "--project=$(abspath("scripts"))")' uv run --group docs jupyter labThe
docsgroup includesjupyterlab, so the interactive launcher stays inside the same project-localuvenvironment used for the book build.Then select:
Python 3for notebooks undernotebooks_py/QuIP Julia 1.12,QuIP Julia, or another Julia kernel for notebooks undernotebooks_jl/
If you see a Python
SyntaxErroron a line likeIN_COLAB = haskey(ENV, ...) || ..., the Julia notebook is running with the wrong kernel. The first Julia cell will activate the notebook-specific project undernotebooks_jl/envs/, so one local Julia kernel is enough for all Julia notebooks.