All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.danielTucano.python.pythonExecution.kt Maven / Gradle / Ivy

package io.github.danielTucano.python

import io.github.danielTucano.python.PythonScriptBuilder.Companion.addCommand
import io.github.danielTucano.python.PythonScriptBuilder.Companion.commandsString
import io.github.danielTucano.python.PythonScriptBuilder.Companion.eraseCommands

/**
 * Erase all commands in memory, fill memory with new commands in "pythonCommands" provided function and execute them
 */
fun pythonExecution(pythonConfig: PythonConfig = PythonConfig.systemDefaultPythonConfig(), pythonCommands: () -> Unit) {
    eraseCommands()
    val pyCommand = PyCommand(pythonConfig)
    addCommand("import matplotlib.pyplot as plt")
    addCommand("import numpy as np")

    pythonCommands()

    pyCommand.execute(commandsString())
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy