Documentation ¶
Index ¶
- Constants
- Variables
- func EnsureVenv(pypath, folder string) (string, error)
- func KillPython(w http.ResponseWriter, r *http.Request)
- func RunCommand(pypath string, args []string) error
- func RunPython(w http.ResponseWriter, r *http.Request)
- func SearchPython() (string, error)
- func Start(db *database.AdminDB, i *run.Info, h run.BuiltinHelper) error
- func StartPythonProcess(w http.ResponseWriter, r *http.Request)
- func StopPython(w http.ResponseWriter, r *http.Request)
- func TestPython(exepath string) error
- type PythonCandidate
- type PythonSettings
Constants ¶
View Source
const PluginName = "python"
Variables ¶
View Source
var Handler = func() *chi.Mux { mux := chi.NewMux() mux.NotFound(rest.NotFoundHandler) mux.MethodNotAllowed(rest.NotFoundHandler) mux.Post("/runtypes/python", StartPythonProcess) mux.Delete("/runtypes/python/{apikey}", StopPython) return mux }()
Handler is the main API handler
View Source
var PathNames = []string{"python", "python3", "pypy3"}
Paths to search for the executable. These are commonly used names when python is in PATH
Functions ¶
func EnsureVenv ¶
EnsureVenv makes sure that a venv exists in the given folder. If not, it creates one there. Returns the path of the venv's python executable.
func KillPython ¶
func KillPython(w http.ResponseWriter, r *http.Request)
func RunCommand ¶
func SearchPython ¶
SearchPython finds a valid installed python version
func StartPythonProcess ¶
func StartPythonProcess(w http.ResponseWriter, r *http.Request)
func StopPython ¶
func StopPython(w http.ResponseWriter, r *http.Request)
func TestPython ¶
TestPython checks if the given python version satisfies all requirements
Types ¶
type PythonCandidate ¶
type PythonSettings ¶
type PythonSettings struct { sync.Mutex // Defends Cmd Cmd map[string]*run.Cmd `mapstructure:"-"` IsEnabled bool `mapstructure:"-"` DB *database.AdminDB `mapstructure:"-"` Path string `mapstructure:"path"` PipArgs []string `mapstructure:"pip_args"` VenvArgs []string `mapstructure:"venv_args"` PerPluginVenv bool `mapstructure:"per_plugin_venv"` }
Click to show internal directories.
Click to hide internal directories.