curry.backends.py.loader module

Loads a generated Python module into an interpreter.

The module is loaded through importlib, so CPython’s bytecode cache applies: a valid cache beside the file (__pycache__) is read instead of the source. The cache is a product of the toolchain, like the file itself, not a by-product of an import. The toolchain writes it when it writes the file (see Json2Py), and the loader writes it when it finds none or a stale one, with or without -B. So a generated module is compiled from source at most once per change, not in every process. Compiling the generated Prelude from source costs about 0.2 s; reading its cache costs a few milliseconds.

curry.backends.py.loader.load_module(interp, pyfile, from_plan=False)[source]