Skip to content

Commit 1b1c0eb

Browse files
committed
overhaul README
1 parent 793d5a1 commit 1b1c0eb

File tree

1 file changed

+113
-39
lines changed

1 file changed

+113
-39
lines changed

README.md

Lines changed: 113 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,62 +12,108 @@ for the frontend extension.
1212

1313
- JupyterLab >= 4.0.0
1414

15-
## Install
15+
## Installation
1616

17-
To install the extension, execute:
17+
To install the extension, run:
1818

1919
```bash
2020
pip install jupyter_rtc_core
2121
```
2222

23-
## Uninstall
24-
25-
To remove the extension, execute:
23+
To remove the extension, run:
2624

2725
```bash
2826
pip uninstall jupyter_rtc_core
2927
```
3028

31-
## Troubleshoot
29+
## Contributing
3230

33-
If you are seeing the frontend extension, but it is not working, check
34-
that the server extension is enabled:
31+
### Setting up a development environment
3532

36-
```bash
37-
jupyter server extension list
33+
We recommend using
34+
[Micromamba](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html)
35+
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
3843
```
3944

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:
4248

43-
```bash
44-
jupyter labextension list
49+
```sh
50+
micromamba activate rtccore
4551
```
4652

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.
4856

49-
### Development install
5057

51-
Note: You will need NodeJS to build the extension package.
58+
### Development install
5259

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.
5663

5764
```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
6866
```
6967

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.
71117

72118
```bash
73119
# Watch the source directory in one terminal, automatically rebuilding when needed
@@ -76,25 +122,37 @@ jlpm watch
76122
jupyter lab
77123
```
78124

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).
80129

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:
82134

83135
```bash
84136
jupyter lab build --minimize=False
85137
```
86138

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+
87143
### Development uninstall
88144

145+
To undo the development installation, run this command:
146+
89147
```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
93149
```
94150

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.
98156

99157
### Testing the extension
100158

@@ -137,3 +195,19 @@ More information are provided within the [ui-tests](./ui-tests/README.md) README
137195
### Packaging the extension
138196

139197
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:
210+
211+
```bash
212+
jupyter labextension list
213+
```

0 commit comments

Comments
 (0)