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
Copy file name to clipboardExpand all lines: README.md
+62-7Lines changed: 62 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,18 @@
1
-
# Jupyter Builder - GSoC 2024
1
+
# Jupyter Builder
2
2
3
3
Build tools for JupyterLab (and remixes)
4
4
5
-
> This _will_ start as an extraction of the builder tools currently included in
6
-
> the core [JupyterLab](https://github.com/jupyterlab/jupyterlab).
5
+
> \[!NOTE\]
6
+
> This started by the extraction of the builder tools included in
7
+
> the core [JupyterLab](https://github.com/jupyterlab/jupyterlab) during a GSoC project. See [below](#gsoc-2024-anecdote) for more information.
7
8
8
9
## Why extracting the build tools?
9
10
10
11
- This would also solve some chicken-and-egg problems like jupyterlab/jupyterlab_pygments#23.
11
12
- Isolating the builder functionalities will simplify the work
12
13
of core and extension developers who can now focus on their respective parts of the
13
-
codebase instead of the earlier intertwined code. It will in particular reduce the need to update the maintenance tooling to produce extension compatible with newer version of Jupyter app.
14
+
codebase instead of the earlier intertwined code.
15
+
- It will in particular reduce the need to update the maintenance tooling to produce extension compatible with newer version of Jupyter app.
14
16
15
17
## How to install the package?
16
18
@@ -29,11 +31,11 @@ pip install jupyter_builder
29
31
```
30
32
- `develop` : Install the Jupyter extension JavaScript assets in dev mode for consumption in the Jupyter app. It similar to [editable install mode of pip](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs)
31
33
```
32
-
jupyter-builder develop --overwrite (path to extension folder)
34
+
jupyter-builder develop --overwrite <path to extension folder>
33
35
```
34
36
- `watch` : Automatically rebuild the development JavaScript assets when one file is changed to ease development.
35
37
```
36
-
jupyter-builder watch (path to extension folder)
38
+
jupyter-builder watch <path to extension folder>
37
39
```
38
40
- Provides a NPM package manager: `jlpm`
39
41
@@ -45,4 +47,57 @@ Execute the following command in a terminal:
45
47
pip uninstall jupyter_builder
46
48
```
47
49
48
-
See https://github.com/jupyterlab/jupyterlab/issues/13456
> Written by [@cronan03](https://github.com/cronan03) - GSoC Contributor 2024
55
+
56
+
### Goal
57
+
58
+
The goals of this project are:
59
+
60
+
- to extract that tooling as a new separate package to ease maintenance (for core and extension developers)
61
+
- update the existing package to use the new one
62
+
- make it configurable to be reused for other applications.
63
+
64
+
### What I did
65
+
66
+
1. Successfully created a CLI with the processes `develop`, `build` and `watch` mentioned above.
67
+
1. Created extensive unit tests using `Pytest` to ensure the processes run efficiently on any OS.
68
+
1. Reduced external dependencies by bringing `jlpm` and `jupyterlab.semver` to the package.
69
+
1. Pre released the package. It can be found on Pypi here https://pypi.org/project/jupyter-builder/
70
+
1. Initiated a solution to the issue https://github.com/jupyterlab/jupyterlab/issues/13456
71
+
72
+
### What's left to do
73
+
74
+
1. We should bring `@jupyterlab/builder` within this package and make it generic.
75
+
For now the code lives there: https://github.com/jupyterlab/jupyterlab/tree/main/builder
76
+
1. https://github.com/jupyterlab/jupyter-builder/blob/fffb100fc57ecb147bface4441f91bfd0cb6ff9a/jupyter_builder/federated_extensions.py#L296 which is responsible for checking version overlap has been temporarily ignored to make the build feature work.
- This PR focuses on extracting the `develop` feature which is responsible for installing the Jupyter extension JS assets in dev mode.
83
+
- Considering the size of [labextension.py](https://github.com/jupyterlab/jupyterlab/blob/main/jupyterlab/labextensions.py), only features essential to Jupyter builder were added.
84
+
- Each of the features will inherit from the class `BaseExtensionApp` present [here](https://github.com/jupyterlab/jupyter-builder/blob/main/jupyter_builder/base_extension_app.py)
85
+
- The [federated_extensions.py](https://github.com/jupyterlab/jupyter-builder/blob/main/jupyter_builder/federated_extensions.py) sets up and executes commands to build, develop and waatch a JupyterLab extension. It resolves paths, constructs the appropriate command-line arguments, and executes the build process using `subprocess.check_call`. Optional parameters allow for customization of the build process, including logging, development mode, and source map generation.
- The `watch` feature on running will rebuild the JS assets on being triggered. This happens on changing contents in `<extension_folder>/src/index.ts`
92
+
- To test this feature we deliberately make a change in `index.ts` triggering `watch`. This replaces old JS assets with new ones having different hash values in the file names. We create 2 vectors of filenames before and after triggering `watch` which will tell us if it actually worked.
- To reduce external dependencies, we added `jlpm` to this package.
95
+
- It existed [here](https://github.com/jupyterlab/jupyterlab/blob/main/jupyterlab/jlpmapp.py) with the [entrypoint](https://github.com/jupyterlab/jupyterlab/blob/e048f27548969c0e4403417ac04bc186f119128f/pyproject.toml#L60).
- Documented the working of the Jupyter builder along with installation guide.
98
+
99
+
### Challenges and Learning
100
+
101
+
1. One of the main challenges was starting this project from scratch with no pre existing code to rely on. I thank my mentor [@fcollonval](https://github.com/fcollonval) for creating the skeleton in https://github.com/jupyterlab/jupyter-builder/pull/2 which gave me a base to work on.
102
+
1. Selecting relevant features for Jupyter builder from [labextension.py](https://github.com/jupyterlab/jupyterlab/blob/main/jupyterlab/labextensions.py) was really tough without a thorough understanding on which functions Jupyter builder would actually rely on.
103
+
1. Creating tests for the `watch` feature was tricky as I had to carefully adjust sleep times to make sure the function was running before a change in `<extension_folder>/src/index.ts` was made. Otherwise the change happened before `watch` ran and never triggered it.
0 commit comments