compile_file#

Import

from scenet import compile_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_file(path, *, library=None, metrics=None)[source]#

Compile one panel from a file.

Parameters:
  • path (Path) – A *.panel.yaml document.

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

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

Return type:

CompileResult

Returns:

The compiled panel.

Raises:

Note

Files the document names are read from the folder it is in, whatever the working directory. One panel only, as compile_source.

Example

>>> from pathlib import Path
>>> from tempfile import TemporaryDirectory
>>> from scenet import compile_file
>>> with TemporaryDirectory() as folder:
...     path = Path(folder) / "hello.panel.yaml"
...     _ = path.write_text("cast: {a: {reference: alice}}", encoding="utf-8")
...     result = compile_file(path)
>>> [actor.id for actor in result.core.actors]
['a']

See also

compile_source, for text. compile_book_file, for any document and its pages.