|
3 | 3 | [](https://github.com/deepnote/jupyterlab-deepnote/actions/workflows/ci.yml) |
4 | 4 | [](https://codecov.io/gh/deepnote/jupyterlab-deepnote) |
5 | 5 |
|
6 | | -A Deepnote extension for JupyterLab |
7 | | - |
8 | | -This extension is composed of a Python package named `jupyterlab_deepnote` |
9 | | -for the server extension and a NPM package named `jupyterlab-deepnote` |
10 | | -for the frontend extension. |
| 6 | +Read‑only viewer for Deepnote `.deepnote` files inside JupyterLab. |
11 | 7 |
|
12 | 8 | ## Requirements |
13 | 9 |
|
14 | | -- JupyterLab >= 4.0.0 |
| 10 | +- Python 3.9 or higher |
| 11 | +- JupyterLab 4.5.0 or higher |
15 | 12 |
|
16 | 13 | ## Install |
17 | 14 |
|
18 | | -To install the extension: |
| 15 | +Install the extension using pip: |
19 | 16 |
|
20 | 17 | ```bash |
21 | 18 | pip install jupyterlab_deepnote |
22 | 19 | ``` |
23 | 20 |
|
24 | | -## Uninstall |
| 21 | +## Usage |
25 | 22 |
|
26 | | -To remove the extension, execute: |
| 23 | +After installation you can: |
27 | 24 |
|
28 | | -```bash |
29 | | -pip uninstall jupyterlab_deepnote |
30 | | -``` |
| 25 | +- Open Deepnote files (`.deepnote`) containing Deepnote projects in JupyterLab |
| 26 | +- Switch between notebooks inside a `.deepnote` file |
| 27 | +- View content in **read‑only** mode (no editing or saving back to the `.deepnote` file) |
31 | 28 |
|
32 | | -## Troubleshoot |
| 29 | +## Troubleshooting |
33 | 30 |
|
34 | | -If you are seeing the frontend extension, but it is not working, check |
35 | | -that the server extension is enabled: |
| 31 | +If you encounter issues with the extension, verify that both the server and frontend extensions are properly installed and enabled. |
| 32 | + |
| 33 | +Check server extensions: |
36 | 34 |
|
37 | 35 | ```bash |
38 | 36 | jupyter server extension list |
39 | 37 | ``` |
40 | 38 |
|
41 | | -If the server extension is installed and enabled, but you are not seeing |
42 | | -the frontend extension, check the frontend extension is installed: |
| 39 | +Check frontend extensions: |
43 | 40 |
|
44 | 41 | ```bash |
45 | 42 | jupyter labextension list |
46 | 43 | ``` |
47 | 44 |
|
48 | | -## Contributing |
49 | | - |
50 | | -### Development install |
51 | | - |
52 | | -Note: You will need NodeJS to build the extension package. |
53 | | - |
54 | | -Use any Python environment and dependency manager you like, for example [uv](https://docs.astral.sh/uv/getting-started/installation/): |
55 | | - |
56 | | -```shell |
57 | | -curl -LsSf https://astral.sh/uv/install.sh | sh |
58 | | -``` |
59 | | - |
60 | | -Create a Python environment in the project directory: |
61 | | - |
62 | | -```shell |
63 | | -uv venv --python 3.12 --managed-python |
64 | | -``` |
65 | | - |
66 | | -Activate the Python environment: |
67 | | - |
68 | | -```shell |
69 | | -source .venv/bin/activate |
70 | | -``` |
71 | | - |
72 | | -Install `jupyterlab`. The extension package itself doesn’t depend on `jupyterlab`, you just need `jupyterlab` in the environment where you will be testing the extension. |
73 | | - |
74 | | -```shell |
75 | | -uv pip install jupyterlab |
76 | | -``` |
77 | | - |
78 | | -**Configure Access to @deepnote/blocks Package** |
79 | | - |
80 | | -The `@deepnote/blocks` package is published on GitHub Packages. To install it, you'll need to authenticate with GitHub: |
81 | | - |
82 | | -1. Create a GitHub Personal Access Token (classic) with `read:packages` scope: |
83 | | - - Go to https://github.com/settings/tokens |
84 | | - - Click "Generate new token (classic)" |
85 | | - - Select the `read:packages` scope |
86 | | - - Generate and copy the token |
87 | | - |
88 | | -2. Set the `GITHUB_TOKEN` environment variable to ensure `jlpm` (which is a wrapper around Yarn) can download the `@deepnote/blocks` package from the GitHub package registry. You can export the variable in `.zshrc` (or by reading a `~/.env` file): |
89 | | - ```shell |
90 | | - export GITHUB_TOKEN=your_token_here |
91 | | - ``` |
92 | | - Replace `YOUR_TOKEN_HERE` with your actual token. |
93 | | - |
94 | | -Install the extension package in editable mode. It installs the package’s dependencies, too: |
95 | | - |
96 | | -```shell |
97 | | -uv pip install --editable . --verbose |
98 | | -``` |
99 | | - |
100 | | -Link your development version of the extension with JupyterLab: |
101 | | - |
102 | | -```shell |
103 | | -jupyter labextension develop . --overwrite |
104 | | -``` |
105 | | - |
106 | | -Enable the extension in Jupyter Server: |
107 | | - |
108 | | -```shell |
109 | | -jupyter server extension enable jupyterlab_deepnote |
110 | | -``` |
111 | | - |
112 | | -Rebuild the extension’s Typescript source after making changes: |
113 | | - |
114 | | -```shell |
115 | | -jlpm run watch |
116 | | -``` |
117 | | - |
118 | | -The `jlpm` command is JupyterLab's pinned version of |
119 | | -[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use |
120 | | -`yarn` or `npm` instead of `jlpm` below. |
121 | | - |
122 | | -In a separate terminal, run `jupyter lab`. You can add the `--debug` option to see HTTP requests in the logs, which can be helpful for debugging. |
123 | | - |
124 | | -```shell |
125 | | -jupyter lab --debug |
126 | | -``` |
127 | | - |
128 | | -You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension. |
129 | | - |
130 | | -```bash |
131 | | -# Watch the source directory in one terminal, automatically rebuilding when needed |
132 | | -jlpm watch |
133 | | -# Run JupyterLab in another terminal |
134 | | -jupyter lab |
135 | | -``` |
136 | | - |
137 | | -With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt). |
138 | | - |
139 | | -By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command: |
140 | | - |
141 | | -```bash |
142 | | -jupyter lab build --minimize=False |
143 | | -``` |
| 45 | +## Uninstall |
144 | 46 |
|
145 | | -### Development uninstall |
| 47 | +To remove the extension, run: |
146 | 48 |
|
147 | 49 | ```bash |
148 | | -# Server extension must be manually disabled in develop mode |
149 | | -jupyter server extension disable jupyterlab_deepnote |
150 | 50 | pip uninstall jupyterlab_deepnote |
151 | 51 | ``` |
152 | 52 |
|
153 | | -In development mode, you will also need to remove the symlink created by `jupyter labextension develop` |
154 | | -command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions` |
155 | | -folder is located. Then you can remove the symlink named `jupyterlab-deepnote` within that folder. |
156 | | - |
157 | | -### Testing the extension |
158 | | - |
159 | | -#### Server tests |
160 | | - |
161 | | -This extension is using [Pytest](https://docs.pytest.org/) for Python code testing. |
162 | | - |
163 | | -Install test dependencies (needed only once): |
164 | | - |
165 | | -```sh |
166 | | -pip install -e ".[test]" |
167 | | -# Each time you install the Python package, you need to restore the front-end extension link |
168 | | -jupyter labextension develop . --overwrite |
169 | | -``` |
170 | | - |
171 | | -To execute them, run: |
172 | | - |
173 | | -```sh |
174 | | -pytest -vv -r ap --cov jupyterlab_deepnote |
175 | | -``` |
176 | | - |
177 | | -#### Frontend tests |
178 | | - |
179 | | -This extension is using [Jest](https://jestjs.io/) for JavaScript code testing. |
180 | | - |
181 | | -To execute them, execute: |
182 | | - |
183 | | -```sh |
184 | | -jlpm |
185 | | -jlpm test |
186 | | -``` |
187 | | - |
188 | | -### Packaging the extension |
| 53 | +## Contributing |
189 | 54 |
|
190 | | -See [RELEASE](RELEASE.md) |
| 55 | +Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to contribute to this project. |
0 commit comments