/ src / lib.rs
lib.rs
 1  //! athenaCL is an algorithmic music composition tool.
 2  
 3  use rustpython_vm as vm;
 4  use vm::Interpreter as PyInterpreter;
 5  pub use app::App;
 6  
 7  mod dialog_ext;
 8  mod interpreter;
 9  mod xml_tools_ext;
10  mod app;
11  
12  /// Initialize the python interpreter with precompiled stdlib and athenaCL (python modules).
13  pub fn init_py_interpreter() -> PyInterpreter {
14      let mut settings = vm::Settings::default();
15      settings.optimize = 2;
16      PyInterpreter::with_init(settings, |vm| {
17          vm.add_native_modules(rustpython_stdlib::get_module_inits());
18          vm.add_frozen(rustpython_pylib::FROZEN_STDLIB);
19          vm.add_frozen(vm::py_freeze!(dir = "pysrc"));
20          xml_tools_ext::make_module(vm);
21          dialog_ext::make_module(vm);
22      })
23  }