Python API reference

The public classes are shared by jupyter_lecture_studio and the compatible lecture_studio namespace. Methods display in Jupyter by default. Use show=False to return HTML in scripts.

LectureDeck

class lecture_studio.LectureDeck(course='مختبر التعلم', *, series='LECTURE STUDIO', lesson='', language='python', theme='gold', brand=None, **theme_options)

A course brand, a visual theme and a collection of reusable components.

cover/slide/note/table display immediately in Jupyter; show=False returns HTML. Pass show=False in scripts. export() saves all accumulated components.

__init__(course='مختبر التعلم', *, series='LECTURE STUDIO', lesson='', language='python', theme='gold', brand=None, **theme_options)
cover(title, description='', *, kicker='', tags=(), sections=(), hero_code='', hero_result='', hero_label=None, footer_label=None, show=True)
slide(title, description='', *, cards=(), subtitle='', diagram=None, activity=None, show=True)
note(title, body='', *, show=True)
table(title, headers, rows, *, show=True)
render(content, *, show=True)

Render a component dict or a list; unknown fields raise useful errors.

classmethod from_file(path, *, show=True)

Load one portable JSON course file and render its components.

export(path, *, title=None)

Save a standalone HTML file with embedded styles and no scripts.

clear()

Start a fresh collection and reset numbering when rerunning notebook cells.

Content models

class lecture_studio.Brand(course: str = 'مختبر التعلم', series: str = 'LECTURE STUDIO', lesson: str = '', footer: str = 'افهم ← توقّع ← جرّب ← فسّر', language: str = 'python')
Parameters:
  • course (str)

  • series (str)

  • lesson (str)

  • footer (str)

  • language (str)

class lecture_studio.Theme(preset: str = 'gold', accent: str | None = None, background: str | None = None, motion: bool = True, direction: str = 'rtl', max_width: int = 1280, notebook_style: bool = False, external_fonts: bool = False)
Parameters:
  • preset (str)

  • accent (str | None)

  • background (str | None)

  • motion (bool)

  • direction (str)

  • max_width (int)

  • notebook_style (bool)

  • external_fonts (bool)

class lecture_studio.Card(title: str, explanation: str | lecture_studio.models.RichText = '', code: str = '', reason: str | lecture_studio.models.RichText = '', language: str | None = None)
Parameters:
  • title (str)

  • explanation (str | RichText)

  • code (str)

  • reason (str | RichText)

  • language (str | None)

class lecture_studio.CoverSection(title: str, description: str = '')
Parameters:
  • title (str)

  • description (str)

class lecture_studio.Node(value: str, note: str = '', selected: bool = False)
Parameters:
  • value (str)

  • note (str)

  • selected (bool)

class lecture_studio.Diagram(title: str, nodes: list[lecture_studio.models.Node] = <factory>, caption: str = '', direction: str = 'ltr', arrows: bool = True, kind: str = 'flow')
Parameters:
  • title (str)

  • nodes (list[Node])

  • caption (str)

  • direction (str)

  • arrows (bool)

  • kind (str)

class lecture_studio.Activity(question: str, answer: str, code: str = '', language: str | None = None, label: str = 'توقّع قبل التنفيذ', reveal: str = 'اكشف الإجابة وفسّرها')
Parameters:
  • question (str)

  • answer (str)

  • code (str)

  • language (str | None)

  • label (str)

  • reveal (str)

class lecture_studio.RichText(html)

Explicitly trusted author HTML. Never use for untrusted student input.

Parameters:

html (str)

Optional Python diagrams

lecture_studio.diagram_names()
Return type:

tuple[str, …]

lecture_studio.preset_diagram(name)
Parameters:

name (str)

Return type:

Diagram

Offline documentation

jupyter_lecture_studio.documentation_path()

Return the bundled offline documentation index as an absolute Path.

A source checkout needs python tools/build_docs.py first. Published wheels and source archives already contain the generated documentation.

Compatibility adapter

class lecture_studio.compat.LuxurySlideDeck(max_width_px=1280, width_vw=100, **kwargs)

Keeps show(), steps_data and code_snippet working for old lectures.

Model fields must use the declared types. Theme validates its preset, hex colors, direction, booleans and width. Plain content is escaped; RichText contains explicitly trusted author HTML.

See Components and visual identity for the meaning and defaults of theme settings, and مرجع الواجهة — 0.2.0 for the Arabic signatures.