jupyter.notebookFileRoot setting doesn't work properly in multi-project workspace
It seems like that jupyter.notebookFileRoot setting doesn't take in effect in a multi-project workspace where the Python project is not defined as the first project in workspace settings.
How to reproduce the bug
- Create two project folders
cd ~/git
mkdir -p test/java-project test/python-project
mkdir -p test/python-project/src/notebooks
-
Open VScode
-
Important: Add first folder to workspace test/python-project
-
Important: Add second folder to workspace test/java-project
-
Save workspace as "test-workspace.code-workspace"
-
Create
test.pyinpython-project/src/notebookswith
# %%
import sys
import os
#print(sys.path)
print(os.getcwd())
- Running test.py as "python interactive" will output
~/git/test/python-project/src/notebooks
- Add in folder settings for python-project
{
"jupyter.notebookFileRoot": "${workspaceFolder}"
}
- Running test.py as "python interactive" will output
~/git/test/python-project
- Open workspace settings as JSON and change the order of the Python project to:
{
"folders": [
{
"path": "../../git/test/java-project"
},
{
"path": "../../git/test/python-project"
},
],
"settings": {}
}
- Running test.py as "python interactive" will output the incorrect path
~/git/test/python-project/src/notebooks
Thanks for the bug. I believe the root cause of this problem is how we start the interactive window when it's in 'multiple' interactive window mode.
If you set the interactive window mode to perfile, it will work:
"jupyter.interactiveWindowMode": "perFile"
If you set the interactive window mode to perfile, it will work:
"jupyter.interactiveWindowMode": "perFile"
Thanks for the reply.
I applied this setting for user, workspace, and for all folders. Unfortunately, the setting doesn't seem to have any effect. I'm still getting the wrong path (not the ${workspaceFolder} path). I've also restarted VSCode mutlipe times in between the tests just to be sure that the setting will be used.
Actually never mind, it's not working for me with 'perFile' either. We aren't passing the file to the startup of the notebook kernel for the interactive window so it doesn't have a way to identify which 'workspace' it's in.
Actually never mind, it's not working for me with 'perFile' either. We aren't passing the file to the startup of the notebook kernel for the interactive window so it doesn't have a way to identify which 'workspace' it's in.
Ah alright.
I'll just mention that I'm using the latest stable version of Visual Studio Code (1.54.3), ms-python.python (v2021.3.658691958), ms-python.vscode-pylance (v2021.3.2), ms-toolsai.jupyter (v2021.3.619093157) on Mac.
What would be the next step? Classify as bug?
Yeah sorry I thought it was already classified that way. The next step now is for our triage to decide the priority for fixing this.
The root cause of the problem is a little tricky as it would require reworking when we start the underlying kernel for the interactive window.
We should look at the telemetry of the use of this setting.
looks like this has been fixed