-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Problem
Usually in my Python projects I follow the following project structure:
- project root dir
- app (Python module/package)
- notebooks
- subdir
- notebook1.ipynb
- notbook2.ipynb
- data
So my notebooks are in several hierarchy levels in a notebooks
folder.
When I now start a Jupyter notebook server from the root folder, I would like to be able to specify that the working directory of the notebook is the root folder, such that I have direct access to e.g. data
and app
, independently of the running notebook and its location in the file hierarchy.
There is the option jupyter notebook --root-dir
, but this does not change the actual working directories of the notebooks, just the default entry path of the server app.
Proposed Solution
Adding command line arguments for jupyter notebook to set the working directory for each notebook, wherever it is located. E.g.:
jupyter notebook --exec_dir / --working_dir .
# or
jupyter notebook --exec_dir / --working_dir <absolute path>
Additional context
VSCode Jupyter extension offers an option archiving exactly the behaviour:
{
"jupyter.notebookFileRoot": "${workspaceFolder}"
}
The feature is searched for at several Stackoverflow threads, e.g.:
https://stackoverflow.com/questions/67287424/how-to-change-jupyter-notebooks-working-directory-configuration
https://stackoverflow.com/questions/15680463/change-ipython-jupyter-notebook-working-directory#comment103251523_15682400