ex() - Direct Execution

  • Scope Propagation – Executes generated Python code directly within the caller's global namespace (sys._getframe(1).f_globals), allowing it to read, write, and modify local variables inline while automatically printing the script to the console.
  • Shadow Copy Integrity – Protects local files when the data parameter is supplied by creating a temporary copy.<filename> backup, automatically replacing and restoring the original file if the script execution fails.
Signature
ranno.ex(prompt: str, data: Optional[str] = None, config: Optional[dict] = None) -> AIResult
ParameterTypeRequiredDescription
promptstrYesThe natural language command.
datastrNoFile path to target CSV, Excel, or JSON dataset. Enables Shadow Copy rollback.
configdictNoOptional configuration overrides.
ReturnsDescription
AIResultSubclass of string containing the executed code.
ex() - API
from ranno import ex

# Execute prompt instantly ex("print('Hello from Ranno execution context')")
# Execute tasks with dataset context ex("Plot salary vs department", data="employees.csv")