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
to create and manage a custom Python environment for developing this package.
36
+
Micromamba provides most of the same CLI as Conda, but works much faster.
37
+
38
+
First, set up a development environment by running this command from the root of
39
+
this repository:
40
+
41
+
```sh
42
+
micromamba env create -f dev-environment.yml
38
43
```
39
44
40
-
If the server extension is installed and enabled, but you are not seeing
41
-
the frontend extension, check the frontend extension is installed:
45
+
This creates a new Python environment named `rtccore` and automatically installs
46
+
this extension's build dependencies, required for local development. Then,
47
+
activate the environment:
42
48
43
-
```bash
44
-
jupyter labextension list
49
+
```sh
50
+
micromamba activate rtccore
45
51
```
46
52
47
-
## Contributing
53
+
Activating an environment is required to access any Python packages installed in
54
+
that environment. You should activate the environment before developing any
55
+
changes to the `jupyter_rtc_core` package locally.
48
56
49
-
### Development install
50
57
51
-
Note: You will need NodeJS to build the extension package.
58
+
### Development install
52
59
53
-
The `jlpm` command is JupyterLab's pinned version of
54
-
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
55
-
`yarn` or `npm` in lieu of `jlpm`below.
60
+
After ensuring that the `rtccore` environment is activated, you can install an
61
+
editable copy of `jupyter_rtc_core` into your environment by running the script
62
+
below.
56
63
57
64
```bash
58
-
# Clone the repo to your local environment
59
-
# Change directory to the jupyter_rtc_core directory
60
-
# Install package in development mode
61
-
pip install -e ".[test]"
62
-
# Link your development version of the extension with JupyterLab
63
-
jupyter labextension develop . --overwrite
64
-
# Server extension must be manually installed in develop mode
65
-
jupyter server extension enable jupyter_rtc_core
66
-
# Rebuild extension Typescript source after making changes
67
-
jlpm build
65
+
jlpm dev:install
68
66
```
69
67
70
-
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.
68
+
Notes about the development installation:
69
+
70
+
-`jlpm` is JupyterLab's pinned version of [yarn](https://yarnpkg.com/) that is
71
+
installed with JupyterLab. In other words, `jlpm` can be considered an alias of
72
+
`yarn`.
73
+
74
+
-`jlpm dev:install` runs the `dev:install` NPM script defined in `package.json`.
75
+
76
+
- The `dev:install` step uses [`uv`](https://docs.astral.sh/uv/) as a faster,
77
+
more modern replacement for `pip`.
78
+
79
+
After completing this, you should have a working, editable copy of
80
+
`jupyter_rtc_core` in your environment. Run `jupyter lab` and open JupyterLab in
81
+
a browser to verify that `jupyter_rtc_core` is installed.
82
+
83
+
### Development process
84
+
85
+
When making new changes to your local copy of `jupyter_rtc_core`, different
86
+
commands need to be run depending on the types of changes made. Without running
87
+
these commands, the new changes are not reflected in JupyterLab.
88
+
89
+
Here is a summary of the commands to run after making changes:
90
+
91
+
- After updating `package.json` or `yarn.lock`: run `jlpm install` to install
92
+
the frontend dependencies.
93
+
94
+
- After updating any frontend (TS/TSX/JS/CSS): run `jlpm build` to build the lab
95
+
extension (i.e. the frontend).
96
+
97
+
- After updating any backend (Python) file: restart the server to reload the
98
+
server extension (i.e. the backend).
99
+
100
+
- Note that there is no build process when updating a Python file, since
101
+
Python is a scripting language.
102
+
103
+
- After updating entry points or other package metadata in `pyproject.toml`: run
104
+
`jlpm dev:uninstall && jlpm dev:install` to re-do the development installation.
105
+
The package metadata is not updated automatically after local changes, even when
106
+
installing the package in editable mode.
107
+
108
+
- Finally, refresh the JupyterLab page in the browser to load the new
109
+
frontend assets and use the new backend.
110
+
111
+
112
+
### Building on change (frontend only)
113
+
114
+
You can watch the source directory and run JupyterLab at the same time in
115
+
different terminals to watch for changes in the extension's source and
116
+
automatically rebuild the extension.
71
117
72
118
```bash
73
119
# Watch the source directory in one terminal, automatically rebuilding when needed
@@ -76,25 +122,37 @@ jlpm watch
76
122
jupyter lab
77
123
```
78
124
79
-
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).
125
+
With the watch command running, every saved change will immediately be built
126
+
locally and available in your running JupyterLab. Refresh JupyterLab to load the
127
+
change in your browser (you may need to wait several seconds for the extension
128
+
to be rebuilt).
80
129
81
-
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:
130
+
By default, the `jlpm build` command generates the source maps for this
131
+
extension to make it easier to debug using the browser dev tools. To also
132
+
generate source maps for the JupyterLab core extensions, you can run the
133
+
following command:
82
134
83
135
```bash
84
136
jupyter lab build --minimize=False
85
137
```
86
138
139
+
Note that the steps described here only update the application in response to
140
+
changes to frontend (TypeScript) files. Changes to any backend (Python) files
141
+
still require restarting the Jupyter Server.
142
+
87
143
### Development uninstall
88
144
145
+
To undo the development installation, run this command:
146
+
89
147
```bash
90
-
# Server extension must be manually disabled in develop mode
91
-
jupyter server extension disable jupyter_rtc_core
92
-
pip uninstall jupyter_rtc_core
148
+
jlpm dev:uninstall
93
149
```
94
150
95
-
In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
96
-
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
97
-
folder is located. Then you can remove the symlink named `@jupyter/rtc-core` within that folder.
151
+
In development mode, you will also need to remove the symlink created by
152
+
`jupyter labextension develop` command. To find its location, you can run
153
+
`jupyter labextension list` to figure out where the `labextensions` folder is
154
+
located. Then you can remove the symlink named `@jupyter/rtc-core` within that
155
+
folder.
98
156
99
157
### Testing the extension
100
158
@@ -137,3 +195,19 @@ More information are provided within the [ui-tests](./ui-tests/README.md) README
137
195
### Packaging the extension
138
196
139
197
See [RELEASE](RELEASE.md)
198
+
199
+
## Troubleshooting
200
+
201
+
If you are seeing the frontend extension, but it is not working, check
202
+
that the server extension is enabled:
203
+
204
+
```bash
205
+
jupyter server extension list
206
+
```
207
+
208
+
If the server extension is installed and enabled, but you are not seeing
209
+
the frontend extension, check the frontend extension is installed:
0 commit comments