1pub mod arrow_bridge;
14pub mod error_mapping;
15pub mod marshaling;
16pub mod runtime;
17
18const PYTHON_SHAPE_SOURCE: &str = r#"/// @module python
24/// Python interop runtime — provides access to the embedded CPython interpreter.
25///
26/// This module is bundled with the Python language runtime extension and is
27/// only available when the extension is loaded. It does NOT live in `std::*`.
28
29/// Evaluate a Python expression and return its result.
30///
31/// The expression is compiled and executed in the extension's embedded CPython
32/// interpreter. The result is marshalled back to a Shape value.
33pub builtin fn eval(code: string) -> _
34
35/// Import a Python module by name and return it as an opaque handle.
36///
37/// The module is imported in the embedded CPython interpreter. Attribute
38/// access and method calls on the returned handle are forwarded to Python.
39pub builtin fn import(module: string) -> _
40"#;
41
42shape_abi_v1::language_runtime_plugin! {
43 name: c"python",
44 version: c"0.1.0",
45 description: c"Python language runtime for foreign function blocks",
46 shape_source: PYTHON_SHAPE_SOURCE,
47 vtable: {
48 init: runtime::python_init,
49 register_types: runtime::python_register_types,
50 compile: runtime::python_compile,
51 invoke: runtime::python_invoke,
52 dispose_function: runtime::python_dispose_function,
53 language_id: runtime::python_language_id,
54 get_lsp_config: runtime::python_get_lsp_config,
55 free_buffer: runtime::python_free_buffer,
56 drop: runtime::python_drop,
57 }
58}