Skip to content

Commit 58146d8

Browse files
cronan03fcollonval
andauthored
Add GSoC report (#26)
* Update README.md 2 * Update README.md 2.1 final changes as per GSOC requirements * Update README.md Co-authored-by: Frédéric Collonval <[email protected]> * Update README.md Co-authored-by: Frédéric Collonval <[email protected]> * Update README.md Co-authored-by: Frédéric Collonval <[email protected]> * Update README.md Co-authored-by: Frédéric Collonval <[email protected]> * Update README.md Co-authored-by: Frédéric Collonval <[email protected]> * Update README.md Co-authored-by: Frédéric Collonval <[email protected]> * Update README.md Co-authored-by: Frédéric Collonval <[email protected]> * Update README.md * Improve the readme * Fix prettier check * Fix typo --------- Co-authored-by: Frédéric Collonval <[email protected]> Co-authored-by: Frédéric Collonval <[email protected]>
1 parent fffb100 commit 58146d8

File tree

2 files changed

+63
-7
lines changed

2 files changed

+63
-7
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules
44
**/package.json
55
!/package.json
66
jupyter_builder
7+
*.md

README.md

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
# Jupyter Builder - GSoC 2024
1+
# Jupyter Builder
22

33
Build tools for JupyterLab (and remixes)
44

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.
78
89
## Why extracting the build tools?
910

1011
- This would also solve some chicken-and-egg problems like jupyterlab/jupyterlab_pygments#23.
1112
- Isolating the builder functionalities will simplify the work
1213
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.
1416

1517
## How to install the package?
1618

@@ -29,11 +31,11 @@ pip install jupyter_builder
2931
```
3032
- `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)
3133
```
32-
jupyter-builder develop --overwrite (path to extension folder)
34+
jupyter-builder develop --overwrite <path to extension folder>
3335
```
3436
- `watch` : Automatically rebuild the development JavaScript assets when one file is changed to ease development.
3537
```
36-
jupyter-builder watch (path to extension folder)
38+
jupyter-builder watch <path to extension folder>
3739
```
3840
- Provides a NPM package manager: `jlpm`
3941
@@ -45,4 +47,57 @@ Execute the following command in a terminal:
4547
pip uninstall jupyter_builder
4648
```
4749
48-
See https://github.com/jupyterlab/jupyterlab/issues/13456
50+
______________________________________________________________________
51+
52+
## GSoC 2024 Anecdote
53+
54+
> 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.
77+
1. Update JupyterLab core to use this new package
78+
79+
### Merged PRs
80+
81+
1. https://github.com/jupyterlab/jupyter-builder/pull/11
82+
- 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.
86+
1. https://github.com/jupyterlab/jupyter-builder/pull/13
87+
- This PR focuses on extracting the `build` feature which is responsible for creating the Javascript assets which will be consumed by the Jupyter App.
88+
- It will always result in the creation of a file `static/style.js` in `<extension_folder>/myextension/labextension`.
89+
- Tests have been crafted using `Pytest` to check for the existence of files mentioned above on running the `build` command.
90+
1. https://github.com/jupyterlab/jupyter-builder/pull/18
91+
- 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.
93+
1. https://github.com/jupyterlab/jupyter-builder/pull/20
94+
- 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).
96+
1. https://github.com/jupyterlab/jupyter-builder/pull/22
97+
- 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

Comments
 (0)