r2x_python/lib.rs
1//! Python-Rust bridge for plugin execution
2//!
3//! This bridge provides a minimal, focused interface for:
4//! 1. Loading plugin package metadata via entry points
5//! 2. Executing plugins with configuration
6//!
7//! Plugin discovery uses AST-based analysis instead of runtime inspection,
8//! making it more efficient and reducing Python interpreter overhead.
9//!
10//! ## PYTHONHOME Configuration
11//!
12//! PYTHONHOME is resolved from the venv's `pyvenv.cfg` file to ensure
13//! compatibility with PyO3 (which is linked at build time). This avoids
14//! version mismatches between the discovered Python and the compiled binary.
15
16pub mod errors;
17pub mod plugin_invoker;
18mod plugin_kwargs;
19mod plugin_regular;
20mod plugin_upgrader;
21mod python_bridge;
22mod utils;
23
24pub use errors::BridgeError;
25pub use plugin_invoker::{PluginInvocationResult, PluginInvocationTimings};
26pub use python_bridge::{configure_python_venv, Bridge, PythonEnvCompat as PythonEnvironment};
27pub use utils::{resolve_python_path, resolve_site_package_path, PYTHON_LIB_DIR};
28
29#[cfg(test)]
30mod tests {
31 #[test]
32 fn test_bridge_module_exports() {
33 // Verify that key types are exported
34 // Bridge and configure_python_venv should be publicly accessible
35 }
36}