jupyter-server / jupyter_server

The backend—i.e. core services, APIs, and REST endpoints—to Jupyter web applications.
https://jupyter-server.readthedocs.io
BSD 3-Clause "New" or "Revised" License
489 stars 308 forks source link

Notebook not opened in browser when `use_redirect_file=false` set #1325

Open randomir opened 1 year ago

randomir commented 1 year ago

Description

With notebook~=6.0, this:

jupyter notebook --NotebookApp.use_redirect_file=false /path/to/notebook

opens the specified notebook in browser, skipping the /tree view.

Now, with notebook~=7.0 (and after changing NotebookApp --> ServerApp), this:

jupyter notebook --ServerApp.use_redirect_file=false /path/to/notebook

does not open the expected notebook, but instead opens the /tree path.

Note: both commands need token and password set to an empty string for the open to work smoothly (assuming safe environment here).

Reproduce

  1. Install notebook~=7.0
  2. Run:
    jupyter notebook --ServerApp.use_redirect_file=false --ServerApp.token='' --ServerApp.password='' /path/to/notebook
  3. A tree view is launched in the browser (e.g. http://localhost:8888/tree), instead of the notebook asked, on e.g. http://localhost:8888/notebooks/path/to/notebook.

Expected behavior

According to docs, opening a specific notebook from the CLI should still work.

It turns out it doesn't work just when the redirect file is not used, i.e. it does work when use_redirect_file=true.

For some use cases, use of local redirect files is not an option (e.g. an online IDE, like GitPod or Codespaces).

Now, my question is, is this really the expected/desired behavior?

A workaround

jupyter notebook --JupyterNotebookApp.default_url='notebooks/<path/to/notebook>'

Opens the specified notebook, but it has a few drawbacks.

Context

Note: this issue was migrated from the jupyter notebook repo.

welcome[bot] commented 1 year ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada: