Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 16 additions & 19 deletions pkg/lang/ir/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,38 +56,35 @@ func (g Graph) compileVSCode() (*llb.State, error) {
}

func (g *Graph) compileJupyter() error {
if g.JupyterConfig != nil {
g.PyPIPackages = append(g.PyPIPackages, "jupyter")
switch g.Language.Name {
case "python":
return nil
default:
return errors.Newf("Jupyter is not supported in %s yet", g.Language.Name)
}
if g.JupyterConfig == nil {
return nil
}

g.PyPIPackages = append(g.PyPIPackages, "jupyter")
switch g.Language.Name {
case "python":
return nil
default:
return errors.Newf("Jupyter is not supported in %s yet", g.Language.Name)
}
return nil
}

func (g Graph) generateJupyterCommand(workingDir string) []string {
if g.JupyterConfig == nil {
return nil
}

if g.JupyterConfig.Token == "" {
g.JupyterConfig.Token = "''"
}

cmd := []string{
"python3", "-m", "notebook",
"--ip", "0.0.0.0", "--notebook-dir", workingDir,
"--NotebookApp.token", g.JupyterConfig.Token,
"--port", strconv.Itoa(config.JupyterPortInContainer),
}

if g.JupyterConfig.Token != "" {
cmd = append(cmd, "--NotebookApp.token", g.JupyterConfig.Token)
} else {
cmd = append(cmd, "--NotebookApp.token", "''")
}

if g.JupyterConfig.Port != 0 {
p := strconv.Itoa(int(config.JupyterPortInContainer))
cmd = append(cmd, "--port", p)
}
return cmd
}

Expand Down