namespace StabilityMatrix.Core.Python; public interface IPyRunner { /// /// Initializes the Python runtime using the embedded dll. /// Can be called with no effect after initialization. /// /// Thrown if Python DLL not found. Task Initialize(); /// /// One-time setup for get-pip /// Task SetupPip(); /// /// Install a Python package with pip /// Task InstallPackage(string package); /// /// Run a Function with PyRunning lock as a Task with GIL. /// /// Function to run. /// Time limit for waiting on PyRunning lock. /// Cancellation token. /// cancelToken was canceled, or waitTimeout expired. Task RunInThreadWithLock(Func func, TimeSpan? waitTimeout = null, CancellationToken cancelToken = default); /// /// Run an Action with PyRunning lock as a Task with GIL. /// /// Action to run. /// Time limit for waiting on PyRunning lock. /// Cancellation token. /// cancelToken was canceled, or waitTimeout expired. Task RunInThreadWithLock(Action action, TimeSpan? waitTimeout = null, CancellationToken cancelToken = default); /// /// Evaluate Python expression and return its value as a string /// /// Task Eval(string expression); /// /// Evaluate Python expression and return its value /// /// Task Eval(string expression); /// /// Execute Python code without returning a value /// /// Task Exec(string code); /// /// Return the Python version as a PyVersionInfo struct /// Task GetVersionInfo(); }