pb_client.compile ¶
Compiling Python for a hub.
Compilation happens on the client rather than in the service, for two reasons. The script is on the caller's filesystem, so the service would otherwise need to read files belonging to whoever asked -- which stops being reasonable the moment the service is on another machine. And it keeps the compiler, which is a native binary, out of the service entirely.
The compiler is a subprocess, so it runs in a worker thread rather than on the event loop.
Classes¶
CompileError-- The program could not be compiled.CompiledModule-- One compiled module of a program.CompiledProgram-- A compiled program, not yet in the form the hub stores.PbClientError-- Base class for every error this library raises.
Functions¶
compile_program-- Compile a script and every module of its own that it imports.compile_script-- Compile a script into a program, for a hub whose profile is not known.compile_source-- Compile Python source into a program the hub can run.compiler_version-- Return the compiler's version string.describe_compiler-- Return the compiler path and its architecture, for the startup log.pack_program-- Pack compiled modules into the container the hub stores.
Attributes¶
MPY_ABI_VERSION-- The.mpyformat this compiler produces, and the hub must accept.SOURCE_NAME-- The file name to record for source that did not come from a file.