compile_scene_file#

Import

from scenet import compile_scene_file

Defined in

scenet.pipeline (source)

Install

pip install scenet

Since

0.1

Stability

Public: follows semantic versioning. Below 1.0, a minor release may change it, and the CHANGELOG says how.

scenet.pipeline.compile_scene_file(path, *, library=None, metrics=None)[source]#

Compile every panel in a multi-panel file.

Parameters:
  • path (Path) – A *.scene.yaml document. A single-panel document also works and comes back as one entry named panel.

  • library (PuppetLibrary | None) – Characters to draw from. Defaults to the two shipped puppets.

  • metrics (FontMetrics | None) – Font to measure lettering against.

Return type:

dict[str, CompileResult]

Returns:

Panel name to compiled panel, in declaration order – which is reading order.

Raises:

Note

Files the document names are read from the folder it is in. Its pages are not laid out: compile_book_file does that.

Example

>>> from pathlib import Path
>>> from tempfile import TemporaryDirectory
>>> from scenet import compile_scene_file
>>> with TemporaryDirectory() as folder:
...     path = Path(folder) / "two.scene.yaml"
...     _ = path.write_text(
...         "cast: {a: {reference: alice}}\npanels: {one: {}, two: {}}", encoding="utf-8"
...     )
...     panels = compile_scene_file(path)
>>> list(panels)
['one', 'two']

See also

compile_scene, for text. compile_book_file, for its pages too.