Notebook-specific startup script in IJulia Notebooks in VS Code

elenev
Mon, 31 Jul 2023 03:09:04 +0000
New to Julia

When working with Jupyter notebooks, I prefer VS Code’s Jupyter extension over browser-based Notebook or JupyterLab. But it looks like VS Code’s implementation of Julia Jupyter notebooks is something different from IJulia (isdefined(Main, :IJulia) returns false in VS Code but true in JupyterLab).

As a result, my startup_ijulia.jl script doesn’t get run.

Is there any way to make VS Code run it?

I’ve discovered the jupyter.runStartupCommands setting in the VS Code Jupyter extension’s settings.json but it looks like it only takes python commands or IPython magics, which presumably wouldn’t help.

Maybe I can add something to startup.jl (which does get run) that conditions on it being run from VS Code’s Jupyter Extension specifically? That’s a bit hokey, and I don’t know how to condition on that – ENV["TERM_PROGRAM"] doesn’t seem to get set in Jupyter notebooks…

Anyone have any other ideas? TIA.

1 post - 1 participant