Skip to content

Commit 99db942

Browse files
meeseeksmachinejtpiopre-commit-ci[bot]
authored
Backport PR #7244 on branch 7.0.x (Add documentation for updating notebook imports) (#7245)
* Backport PR #7244: Add documentation for updating `notebook` imports * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Jeremy Tuloup <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 9d2cbd8 commit 99db942

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-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: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Server Imports in Notebook 7
2+
3+
Notebook 7 is now based on Jupyter Server, which lets users run multiple Jupyter frontends (e.g. Notebook, JupyterLab, NBClassic, etc.) on the same server.
4+
5+
Prior to Notebook 7, the Classic Notebook server included 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+
10+
passwd("foo")
11+
```
12+
13+
Or:
14+
15+
```python
16+
from notebook import notebookapp
17+
18+
notebookapp.list_running_servers()
19+
```
20+
21+
In Notebook 7, these server modules are now exposed by the `jupyter_server` package. The code snippets above should be updated to:
22+
23+
```python
24+
from jupyter_server.auth import passwd
25+
26+
passwd("foo")
27+
```
28+
29+
And:
30+
31+
```python
32+
from jupyter_server import serverapp
33+
34+
serverapp.list_running_servers()
35+
```
36+
37+
These are just examples, so you may have to adjust your use of `notebook` imports based on the specific server modules you were using.

0 commit comments

Comments
 (0)