You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.:
Really, what most users are after is modifying PYTHONPATH variable for given project. One can set it in kernelspec .json file using an environment variable but this is just not convenient.
More generally, the PYTHONPATH comes from the (working) directory in which kernels are starting up. I think that this option should be named --kernel-startup-dir or similar. Thoughts?
Oh, didn't see that there is already an issue for it and also didn't found the StackOverflow thread. Thank you for reference!
I use similar workarounds in my projects, but IMHO much less convenient than the suggested feature.
Problem
Usually in my Python projects I follow the following project structure:
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
andapp
, 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.:
Additional context
VSCode Jupyter extension offers an option archiving exactly the behaviour:
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
The text was updated successfully, but these errors were encountered: