API Reference

The public Python API is intentionally small. Instructors usually call notebook_ta.load() from a notebook setup cell, and may use notebook_ta.get_registry() for introspection.

notebook-ta public API.

notebook_ta.load(global_config, exercises_config, *, notebook_path=None, llm_overrides=None, llm_enabled=True, debug=False)

Load configuration files, register exercises, run auto-setup if needed, and register the %%notebook_ta IPython magic.

Must be called from within a Jupyter notebook cell.

Parameters:
  • global_config (str | Path) – Path or URL to the global configuration TOML.

  • exercises_config (str | Path) – Path or URL to the exercises TOML.

  • notebook_path (str | Path | None) – Optional path to the .ipynb file. Required only when one or more exercises omit statement from the TOML and the statement should instead be extracted from the notebook’s markdown cells (<div id="<exercise_id>">…</div> pattern). If not provided the system will try to detect the notebook path automatically; pass this argument explicitly when auto-detection fails.

  • llm_overrides (dict[str, Any] | None) – Optional dict of LLM settings that override the values from global_config. Valid keys mirror LLMConfig fields (e.g. model, base_url, provider, api_key_env, timeout). Literal API key values are not accepted.

  • llm_enabled (bool) – When False, skip LLM provider creation, availability checks, automatic model selection, and local Ollama setup. The notebook magic remains available and behaves as though no LLM backend can be reached. Defaults to True.

  • debug (bool) – When True, enable DEBUG-level logging, display the final LLM prompt before each call, and show separated model thinking before the final answer when the provider supplies it. Defaults to False.

Return type:

None

notebook_ta.get_registry()

Return the active ExerciseRegistry for introspection.

Return type:

ExerciseRegistry