MCPcopy Create free account
hub / github.com/BerriAI/litellm / initialize_python

Function initialize_python

litellm-rust/crates/host-python/src/lib.rs:47–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45/// parallel test threads never race a first import of `asyncio`.
46#[cfg(test)]
47pub(crate) fn initialize_python() {
48 static IMPORTED: std::sync::Once = std::sync::Once::new();
49 pyo3::Python::initialize();
50 IMPORTED.call_once(|| {
51 pyo3::Python::attach(|py| {
52 py.import("asyncio").expect("asyncio imports");
53 });
54 });
55}
56
57#[cfg(test)]
58pub(crate) struct InitializedPython;

Calls 3

initializeFunction · 0.85
attachFunction · 0.50
expectMethod · 0.45