Skip to content

Commit f90d315

Browse files
committed
Add documentation for updating notebook imports
1 parent 5909ff9 commit f90d315

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

docs/source/configuring/config_overview.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ front-end Notebook client (i.e. the familiar notebook interface).
5252
> - Related: [Configuring a language kernel](https://ipython.readthedocs.io/en/latest/install/kernel_install.html)
5353
> to run in the Jupyter Server enables your server to run other languages, like R or Julia.
5454
55+
```{warning}
56+
Jupyter Notebook 7 is now based on Jupyter Server. This may break some previous `notebook` imports you may have been using, such as `notebook.auth` or `notebook.notebookapp`.
57+
58+
Check out the [migration guide](../migrating/server-imports.md) to learn more on how to update these server imports.
59+
```
60+
5561
(configure-nbextensions)=
5662

5763
## Notebook extensions

docs/source/migrate_to_notebook7.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ notebook_7_features.md
7373
7474
migrating/frontend-extensions.md
7575
migrating/server-extensions.md
76+
migrating/server-imports.md
7677
migrating/custom-themes.md
7778
migrating/multiple-interfaces.md
7879
```
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Server Imports in Notebook 7
2+
3+
Notebook 7 is now based on Jupyter Server, which is a new server application that allows to run multiple Jupyter frontends (e.g. Notebook, JupyterLab, NBClassic, etc.) on the same server.
4+
5+
Prior to Notebook 7, the classic notebook server include the server modules in the `notebook` package. This means it was possible to import the server modules from the `notebook` package, for example:
6+
7+
```python
8+
from notebook.auth import passwd
9+
passwd("foo")
10+
```
11+
12+
Or:
13+
14+
```python
15+
from notebook import notebookapp
16+
notebookapp.list_running_servers()
17+
```
18+
19+
In Notebook 7, these server modules are now exposed by the `jupyter_server` package. The code snippets above should be updated to:
20+
21+
```python
22+
from jupyter_server.auth import passwd
23+
passwd("foo")
24+
```
25+
26+
And:
27+
28+
```python
29+
from jupyter_server import serverapp
30+
serverapp.list_running_servers()
31+
```
32+
33+
These are just examples, so you may have to adjust based on the specific server modules you were using.

0 commit comments

Comments
 (0)