Skip to content

pb_client.compile.compile_program async

compile_program(entry, *, roots=None)

Compile a script and every module of its own that it imports.

Parameters:

Name Type Description Default
entry Path

The script the program starts at.

required
roots Sequence[Path] | None

The directories module names are looked for in, in order. Defaults to the script's own directory, which is right for a program whose modules sit beside it; pb_core.project.module_roots is what works the list out for a project that keeps its source somewhere else.

None

Returns:

Type Description
CompiledProgram

The compiled modules, entry first, ready to be packed once the hub's

CompiledProgram

profile is known.

Raises:

Type Description
CompileError

If a file cannot be read, the compiler rejects one, a module that arrives compiled is not one the hub could run, or a module imports relative to its own package -- which the hub cannot do, so it is refused here where the line can be named.