jupyter-builder 0.1.0a3__tar.gz → 0.1.0a4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/.licenserc.yaml +1 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/.pre-commit-config.yaml +3 -2
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/.prettierignore +2 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/CHANGELOG.md +37 -2
- jupyter_builder-0.1.0a4/PKG-INFO +175 -0
- jupyter_builder-0.1.0a4/README.md +103 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/commands.py +4 -8
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/federated_extensions.py +17 -21
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/jupyterlab_semver.py +574 -2
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/yarn.js +8 -13
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/package.json +29 -3
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/pyproject.toml +3 -3
- jupyter_builder-0.1.0a4/src/build-labextension.ts +149 -0
- jupyter_builder-0.1.0a4/src/build.ts +281 -0
- jupyter_builder-0.1.0a4/src/duplicate-package-checker-webpack-plugin.d.ts +64 -0
- jupyter_builder-0.1.0a4/src/extensionConfig.ts +307 -0
- jupyter_builder-0.1.0a4/src/index.ts +7 -0
- jupyter_builder-0.1.0a4/src/metadata_schema.json +119 -0
- jupyter_builder-0.1.0a4/src/mini-css-extract-plugin.d.ts +8 -0
- jupyter_builder-0.1.0a4/src/webpack-plugins.ts +256 -0
- jupyter_builder-0.1.0a4/src/webpack.config.base.ts +90 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/tests/test_tpl.py +43 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/tsconfig.json +8 -4
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/yarn.lock +1331 -24
- jupyter_builder-0.1.0a3/PKG-INFO +0 -119
- jupyter_builder-0.1.0a3/README.md +0 -48
- jupyter_builder-0.1.0a3/src/index.ts +0 -6
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/.copier-answers.yml +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/.gitignore +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/.yarnrc.yml +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/LICENSE +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/RELEASE.md +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/__init__.py +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/base_extension_app.py +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/core_path.py +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/debug_log_file_mixin.py +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/extension_commands/__init__.py +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/extension_commands/build.py +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/extension_commands/develop.py +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/extension_commands/watch.py +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/federated_extensions_requirements.py +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/jlpm.py +0 -0
- {jupyter_builder-0.1.0a3 → jupyter_builder-0.1.0a4}/jupyter_builder/main.py +0 -0
|
@@ -20,6 +20,7 @@ repos:
|
|
|
20
20
|
- id: end-of-file-fixer
|
|
21
21
|
exclude: \.copier-answers\.yml
|
|
22
22
|
- id: trailing-whitespace
|
|
23
|
+
exclude: yarn.js
|
|
23
24
|
|
|
24
25
|
- repo: https://github.com/python-jsonschema/check-jsonschema
|
|
25
26
|
rev: 0.27.4
|
|
@@ -38,7 +39,7 @@ repos:
|
|
|
38
39
|
hooks:
|
|
39
40
|
- id: codespell
|
|
40
41
|
args: ["-L", "sur,nd"]
|
|
41
|
-
exclude: jupyter_builder/yarn.js
|
|
42
|
+
exclude: "jupyter_builder/yarn.js|jupyter_builder/jupyterlab_semver.py"
|
|
42
43
|
|
|
43
44
|
- repo: https://github.com/pre-commit/pygrep-hooks
|
|
44
45
|
rev: "v1.10.0"
|
|
@@ -57,7 +58,7 @@ repos:
|
|
|
57
58
|
["traitlets>=5.13"]
|
|
58
59
|
|
|
59
60
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
60
|
-
rev: v0.
|
|
61
|
+
rev: v0.9.4
|
|
61
62
|
hooks:
|
|
62
63
|
- id: ruff
|
|
63
64
|
types_or: [python, jupyter]
|
|
@@ -2,6 +2,43 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- <START NEW CHANGELOG ENTRY> -->
|
|
4
4
|
|
|
5
|
+
## 0.1.0a4
|
|
6
|
+
|
|
7
|
+
([Full Changelog](https://github.com/jupyterlab/jupyter-builder/compare/v0.1.0a3...2e9b6382798d488315617750333cc50f5a445b5c))
|
|
8
|
+
|
|
9
|
+
### Enhancements made
|
|
10
|
+
|
|
11
|
+
- Sync `yarn.js` with core [#47](https://github.com/jupyterlab/jupyter-builder/pull/47) ([@Darshan808](https://github.com/Darshan808), [@krassowski](https://github.com/krassowski))
|
|
12
|
+
- Add `jupyterlab_server` and update some dependencies [#44](https://github.com/jupyterlab/jupyter-builder/pull/44) ([@Darshan808](https://github.com/Darshan808), [@krassowski](https://github.com/krassowski))
|
|
13
|
+
- Migrated Builder Folder to jupyter-builder [#29](https://github.com/jupyterlab/jupyter-builder/pull/29) ([@Darshan808](https://github.com/Darshan808), [@fcollonval](https://github.com/fcollonval), [@jtpio](https://github.com/jtpio))
|
|
14
|
+
|
|
15
|
+
### Maintenance and upkeep improvements
|
|
16
|
+
|
|
17
|
+
- Bump the actions group across 1 directory with 6 updates [#39](https://github.com/jupyterlab/jupyter-builder/pull/39) ([@krassowski](https://github.com/krassowski))
|
|
18
|
+
- Bump ruff from 0.9.9 to 0.11.2 in the pip group [#36](https://github.com/jupyterlab/jupyter-builder/pull/36) ([@krassowski](https://github.com/krassowski))
|
|
19
|
+
- Bump ruff from 0.9.4 to 0.9.9 in the pip group [#35](https://github.com/jupyterlab/jupyter-builder/pull/35) ([@fcollonval](https://github.com/fcollonval))
|
|
20
|
+
- Bump apache/skywalking-eyes from 0.6.0 to 0.7.0 in the actions group [#34](https://github.com/jupyterlab/jupyter-builder/pull/34) ([@fcollonval](https://github.com/fcollonval))
|
|
21
|
+
- Bump ruff from 0.8.4 to 0.9.4 in the pip group [#33](https://github.com/jupyterlab/jupyter-builder/pull/33) ([@jtpio](https://github.com/jtpio))
|
|
22
|
+
- Bump ruff from 0.8.1 to 0.8.4 in the pip group [#32](https://github.com/jupyterlab/jupyter-builder/pull/32) ([@fcollonval](https://github.com/fcollonval))
|
|
23
|
+
- Bump ruff from 0.7.1 to 0.8.1 in the pip group [#31](https://github.com/jupyterlab/jupyter-builder/pull/31) ([@jtpio](https://github.com/jtpio))
|
|
24
|
+
- Bump ruff from 0.6.8 to 0.7.1 in the pip group [#30](https://github.com/jupyterlab/jupyter-builder/pull/30) ([@fcollonval](https://github.com/fcollonval))
|
|
25
|
+
- Bump ruff from 0.5.5 to 0.6.8 in the pip group across 1 directory [#28](https://github.com/jupyterlab/jupyter-builder/pull/28) ([@fcollonval](https://github.com/fcollonval))
|
|
26
|
+
|
|
27
|
+
### Documentation improvements
|
|
28
|
+
|
|
29
|
+
- Update README.md 2 [#26](https://github.com/jupyterlab/jupyter-builder/pull/26) ([@cronan03](https://github.com/cronan03), [@fcollonval](https://github.com/fcollonval))
|
|
30
|
+
|
|
31
|
+
### Contributors to this release
|
|
32
|
+
|
|
33
|
+
The following people contributed discussions, new ideas, code and documentation contributions, and review.
|
|
34
|
+
See [our definition of contributors](https://github-activity.readthedocs.io/en/latest/use/#how-does-this-tool-define-contributions-in-the-reports).
|
|
35
|
+
|
|
36
|
+
([GitHub contributors page for this release](https://github.com/jupyterlab/jupyter-builder/graphs/contributors?from=2024-07-30&to=2026-02-05&type=c))
|
|
37
|
+
|
|
38
|
+
@cronan03 ([activity](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Acronan03+updated%3A2024-07-30..2026-02-05&type=Issues)) | @Darshan808 ([activity](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3ADarshan808+updated%3A2024-07-30..2026-02-05&type=Issues)) | @fcollonval ([activity](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Afcollonval+updated%3A2024-07-30..2026-02-05&type=Issues)) | @jtpio ([activity](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Ajtpio+updated%3A2024-07-30..2026-02-05&type=Issues)) | @krassowski ([activity](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Akrassowski+updated%3A2024-07-30..2026-02-05&type=Issues))
|
|
39
|
+
|
|
40
|
+
<!-- <END NEW CHANGELOG ENTRY> -->
|
|
41
|
+
|
|
5
42
|
## 0.1.0a3
|
|
6
43
|
|
|
7
44
|
([Full Changelog](https://github.com/jupyterlab/jupyter-builder/compare/v0.1.0a2...464a12d6a8288e06646f0c364ee1477d643c7261))
|
|
@@ -16,8 +53,6 @@
|
|
|
16
53
|
|
|
17
54
|
[@dependabot](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Adependabot+updated%3A2024-07-29..2024-07-30&type=Issues)
|
|
18
55
|
|
|
19
|
-
<!-- <END NEW CHANGELOG ENTRY> -->
|
|
20
|
-
|
|
21
56
|
## 0.1.0a2
|
|
22
57
|
|
|
23
58
|
([Full Changelog](https://github.com/jupyterlab/jupyter-builder/compare/ac6bb51518d309b96658dc45784f4d47a7cd559c...02764ce51fd919bdb5739e06d545656ee0e5b2c9))
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jupyter_builder
|
|
3
|
+
Version: 0.1.0a4
|
|
4
|
+
Summary: JupyterLab build tools
|
|
5
|
+
Project-URL: Homepage, https://jupyter.org
|
|
6
|
+
Project-URL: Source, https://github.com/jupyterlab/jupyterlab_builder
|
|
7
|
+
Project-URL: Issues, https://github.com/jupyterlab/jupyterlab_builder/issues/new/choose
|
|
8
|
+
Project-URL: Gitter, https://gitter.im/jupyterlab/jupyterlab
|
|
9
|
+
Project-URL: Pypi, https://pypi.org/project/jupyter-builder
|
|
10
|
+
Author-email: Jupyter Development Team <jupyter@googlegroups.com>
|
|
11
|
+
License: BSD 3-Clause License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2024, Jupyter Development Team
|
|
14
|
+
All rights reserved.
|
|
15
|
+
|
|
16
|
+
Redistribution and use in source and binary forms, with or without
|
|
17
|
+
modification, are permitted provided that the following conditions are met:
|
|
18
|
+
|
|
19
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
20
|
+
list of conditions and the following disclaimer.
|
|
21
|
+
|
|
22
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
23
|
+
this list of conditions and the following disclaimer in the documentation
|
|
24
|
+
and/or other materials provided with the distribution.
|
|
25
|
+
|
|
26
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
27
|
+
contributors may be used to endorse or promote products derived from
|
|
28
|
+
this software without specific prior written permission.
|
|
29
|
+
|
|
30
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
31
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
32
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
33
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
34
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
35
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
36
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
37
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
38
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
39
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
40
|
+
License-File: LICENSE
|
|
41
|
+
Keywords: ipython,jupyter
|
|
42
|
+
Classifier: Framework :: Jupyter
|
|
43
|
+
Classifier: Framework :: Jupyter :: JupyterLab
|
|
44
|
+
Classifier: Framework :: Jupyter :: JupyterLab :: 4
|
|
45
|
+
Classifier: Intended Audience :: Developers
|
|
46
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
47
|
+
Classifier: Programming Language :: Python
|
|
48
|
+
Classifier: Programming Language :: Python :: 3
|
|
49
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
50
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
51
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
52
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
53
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
54
|
+
Requires-Python: >=3.8
|
|
55
|
+
Requires-Dist: jupyterlab-server
|
|
56
|
+
Requires-Dist: traitlets
|
|
57
|
+
Provides-Extra: dev
|
|
58
|
+
Requires-Dist: build; extra == 'dev'
|
|
59
|
+
Requires-Dist: hatch; extra == 'dev'
|
|
60
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
61
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
62
|
+
Requires-Dist: ruff==0.14.14; extra == 'dev'
|
|
63
|
+
Provides-Extra: test
|
|
64
|
+
Requires-Dist: copier<10,>=9.3; extra == 'test'
|
|
65
|
+
Requires-Dist: coverage; extra == 'test'
|
|
66
|
+
Requires-Dist: jinja2-time; extra == 'test'
|
|
67
|
+
Requires-Dist: jupyterlab; extra == 'test'
|
|
68
|
+
Requires-Dist: pytest-check-links>=0.7; extra == 'test'
|
|
69
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
70
|
+
Requires-Dist: pytest>=7.0; extra == 'test'
|
|
71
|
+
Description-Content-Type: text/markdown
|
|
72
|
+
|
|
73
|
+
# Jupyter Builder
|
|
74
|
+
|
|
75
|
+
Build tools for JupyterLab (and remixes)
|
|
76
|
+
|
|
77
|
+
> \[!NOTE\]
|
|
78
|
+
> This started by the extraction of the builder tools included in
|
|
79
|
+
> the core [JupyterLab](https://github.com/jupyterlab/jupyterlab) during a GSoC project. See [below](#gsoc-2024-anecdote) for more information.
|
|
80
|
+
|
|
81
|
+
## Why extracting the build tools?
|
|
82
|
+
|
|
83
|
+
- This would also solve some chicken-and-egg problems like jupyterlab/jupyterlab_pygments#23.
|
|
84
|
+
- Isolating the builder functionalities will simplify the work
|
|
85
|
+
of core and extension developers who can now focus on their respective parts of the
|
|
86
|
+
codebase instead of the earlier intertwined code.
|
|
87
|
+
- It will in particular reduce the need to update the maintenance tooling to produce extension compatible with newer version of Jupyter app.
|
|
88
|
+
|
|
89
|
+
## How to install the package?
|
|
90
|
+
|
|
91
|
+
Execute the following command in a terminal:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
pip install jupyter_builder
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## What does it do?
|
|
98
|
+
|
|
99
|
+
- Provides a CLI for building Jupyter extensions. There are 3 subcommands
|
|
100
|
+
- `build` : Builds the Jupyter extension JavaScript assets to be consumed by the Jupyter app.
|
|
101
|
+
```
|
|
102
|
+
jupyter-builder build <path to extension folder>
|
|
103
|
+
```
|
|
104
|
+
- `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)
|
|
105
|
+
```
|
|
106
|
+
jupyter-builder develop --overwrite <path to extension folder>
|
|
107
|
+
```
|
|
108
|
+
- `watch` : Automatically rebuild the development JavaScript assets when one file is changed to ease development.
|
|
109
|
+
```
|
|
110
|
+
jupyter-builder watch <path to extension folder>
|
|
111
|
+
```
|
|
112
|
+
- Provides a NPM package manager: `jlpm`
|
|
113
|
+
|
|
114
|
+
## How to uninstall the package?
|
|
115
|
+
|
|
116
|
+
Execute the following command in a terminal:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
pip uninstall jupyter_builder
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
______________________________________________________________________
|
|
123
|
+
|
|
124
|
+
## GSoC 2024 Anecdote
|
|
125
|
+
|
|
126
|
+
> Written by [@cronan03](https://github.com/cronan03) - GSoC Contributor 2024
|
|
127
|
+
|
|
128
|
+
### Goal
|
|
129
|
+
|
|
130
|
+
The goals of this project are:
|
|
131
|
+
|
|
132
|
+
- to extract that tooling as a new separate package to ease maintenance (for core and extension developers)
|
|
133
|
+
- update the existing package to use the new one
|
|
134
|
+
- make it configurable to be reused for other applications.
|
|
135
|
+
|
|
136
|
+
### What I did
|
|
137
|
+
|
|
138
|
+
1. Successfully created a CLI with the processes `develop`, `build` and `watch` mentioned above.
|
|
139
|
+
1. Created extensive unit tests using `Pytest` to ensure the processes run efficiently on any OS.
|
|
140
|
+
1. Reduced external dependencies by bringing `jlpm` and `jupyterlab.semver` to the package.
|
|
141
|
+
1. Pre released the package. It can be found on Pypi here https://pypi.org/project/jupyter-builder/
|
|
142
|
+
1. Initiated a solution to the issue https://github.com/jupyterlab/jupyterlab/issues/13456
|
|
143
|
+
|
|
144
|
+
### What's left to do
|
|
145
|
+
|
|
146
|
+
1. We should bring `@jupyterlab/builder` within this package and make it generic.
|
|
147
|
+
For now the code lives there: https://github.com/jupyterlab/jupyterlab/tree/main/builder
|
|
148
|
+
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.
|
|
149
|
+
1. Update JupyterLab core to use this new package
|
|
150
|
+
|
|
151
|
+
### Merged PRs
|
|
152
|
+
|
|
153
|
+
1. https://github.com/jupyterlab/jupyter-builder/pull/11
|
|
154
|
+
- This PR focuses on extracting the `develop` feature which is responsible for installing the Jupyter extension JS assets in dev mode.
|
|
155
|
+
- Considering the size of [labextension.py](https://github.com/jupyterlab/jupyterlab/blob/main/jupyterlab/labextensions.py), only features essential to Jupyter builder were added.
|
|
156
|
+
- 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)
|
|
157
|
+
- 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.
|
|
158
|
+
1. https://github.com/jupyterlab/jupyter-builder/pull/13
|
|
159
|
+
- This PR focuses on extracting the `build` feature which is responsible for creating the Javascript assets which will be consumed by the Jupyter App.
|
|
160
|
+
- It will always result in the creation of a file `static/style.js` in `<extension_folder>/myextension/labextension`.
|
|
161
|
+
- Tests have been crafted using `Pytest` to check for the existence of files mentioned above on running the `build` command.
|
|
162
|
+
1. https://github.com/jupyterlab/jupyter-builder/pull/18
|
|
163
|
+
- The `watch` feature on running will rebuild the JS assets on being triggered. This happens on changing contents in `<extension_folder>/src/index.ts`
|
|
164
|
+
- 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.
|
|
165
|
+
1. https://github.com/jupyterlab/jupyter-builder/pull/20
|
|
166
|
+
- To reduce external dependencies, we added `jlpm` to this package.
|
|
167
|
+
- 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).
|
|
168
|
+
1. https://github.com/jupyterlab/jupyter-builder/pull/22
|
|
169
|
+
- Documented the working of the Jupyter builder along with installation guide.
|
|
170
|
+
|
|
171
|
+
### Challenges and Learning
|
|
172
|
+
|
|
173
|
+
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.
|
|
174
|
+
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.
|
|
175
|
+
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,0 +1,103 @@
|
|
|
1
|
+
# Jupyter Builder
|
|
2
|
+
|
|
3
|
+
Build tools for JupyterLab (and remixes)
|
|
4
|
+
|
|
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.
|
|
8
|
+
|
|
9
|
+
## Why extracting the build tools?
|
|
10
|
+
|
|
11
|
+
- This would also solve some chicken-and-egg problems like jupyterlab/jupyterlab_pygments#23.
|
|
12
|
+
- Isolating the builder functionalities will simplify the work
|
|
13
|
+
of core and extension developers who can now focus on their respective parts of the
|
|
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.
|
|
16
|
+
|
|
17
|
+
## How to install the package?
|
|
18
|
+
|
|
19
|
+
Execute the following command in a terminal:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
pip install jupyter_builder
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## What does it do?
|
|
26
|
+
|
|
27
|
+
- Provides a CLI for building Jupyter extensions. There are 3 subcommands
|
|
28
|
+
- `build` : Builds the Jupyter extension JavaScript assets to be consumed by the Jupyter app.
|
|
29
|
+
```
|
|
30
|
+
jupyter-builder build <path to extension folder>
|
|
31
|
+
```
|
|
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)
|
|
33
|
+
```
|
|
34
|
+
jupyter-builder develop --overwrite <path to extension folder>
|
|
35
|
+
```
|
|
36
|
+
- `watch` : Automatically rebuild the development JavaScript assets when one file is changed to ease development.
|
|
37
|
+
```
|
|
38
|
+
jupyter-builder watch <path to extension folder>
|
|
39
|
+
```
|
|
40
|
+
- Provides a NPM package manager: `jlpm`
|
|
41
|
+
|
|
42
|
+
## How to uninstall the package?
|
|
43
|
+
|
|
44
|
+
Execute the following command in a terminal:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
pip uninstall jupyter_builder
|
|
48
|
+
```
|
|
49
|
+
|
|
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.
|
|
@@ -79,14 +79,10 @@ def _compare_ranges(spec1, spec2, drop_prerelease1=False, drop_prerelease2=False
|
|
|
79
79
|
|
|
80
80
|
# Check for overlap.
|
|
81
81
|
if (
|
|
82
|
-
gte(x1, y1, True)
|
|
83
|
-
and ly(
|
|
84
|
-
or
|
|
85
|
-
|
|
86
|
-
or gte(y1, x1, True)
|
|
87
|
-
and lx(y1, x2, True)
|
|
88
|
-
or gx(y2, x1, True)
|
|
89
|
-
and lx(y2, x2, True)
|
|
82
|
+
(gte(x1, y1, True) and ly(x1, y2, True))
|
|
83
|
+
or (gy(x2, y1, True) and ly(x2, y2, True))
|
|
84
|
+
or (gte(y1, x1, True) and lx(y1, x2, True))
|
|
85
|
+
or (gx(y2, x1, True) and lx(y2, x2, True))
|
|
90
86
|
):
|
|
91
87
|
# if we ever find an overlap, we can return immediately
|
|
92
88
|
return 0
|
|
@@ -32,10 +32,9 @@ try:
|
|
|
32
32
|
except ImportError:
|
|
33
33
|
from tomli import load
|
|
34
34
|
|
|
35
|
+
from .commands import _test_overlap
|
|
35
36
|
from .core_path import default_core_path
|
|
36
37
|
|
|
37
|
-
# from .commands import _test_overlap TO BE DONE -----------------------------
|
|
38
|
-
|
|
39
38
|
DEPRECATED_ARGUMENT = object()
|
|
40
39
|
|
|
41
40
|
HERE = osp.abspath(osp.dirname(__file__))
|
|
@@ -201,9 +200,7 @@ def build_labextension( # noqa: PLR0913
|
|
|
201
200
|
path, logger=None, development=False, static_url=None, source_map=False, core_path=None
|
|
202
201
|
):
|
|
203
202
|
"""Build a labextension in the given path"""
|
|
204
|
-
|
|
205
203
|
core_path = default_core_path() if core_path is None else str(Path(core_path).resolve())
|
|
206
|
-
|
|
207
204
|
ext_path = str(Path(path).resolve())
|
|
208
205
|
|
|
209
206
|
if logger:
|
|
@@ -293,23 +290,22 @@ def _ensure_builder(ext_path, core_path):
|
|
|
293
290
|
raise ValueError(msg)
|
|
294
291
|
target = osp.dirname(target)
|
|
295
292
|
|
|
296
|
-
#
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
# raise ValueError(msg)
|
|
293
|
+
# Check for compatible versions
|
|
294
|
+
overlap = _test_overlap(
|
|
295
|
+
dep_version1, dep_version2, drop_prerelease1=True, drop_prerelease2=True
|
|
296
|
+
)
|
|
297
|
+
if not overlap:
|
|
298
|
+
with open(
|
|
299
|
+
osp.join(target, "node_modules", "@jupyterlab", "builder", "package.json")
|
|
300
|
+
) as fid:
|
|
301
|
+
dep_version2 = json.load(fid).get("version")
|
|
302
|
+
overlap = _test_overlap(
|
|
303
|
+
dep_version1, dep_version2, drop_prerelease1=True, drop_prerelease2=True
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
if not overlap:
|
|
307
|
+
msg = f"Extensions require a devDependency on @jupyterlab/builder@{dep_version1}, you have a dependency on {dep_version2}" # noqa: E501
|
|
308
|
+
raise ValueError(msg)
|
|
313
309
|
|
|
314
310
|
return osp.join(
|
|
315
311
|
target, "node_modules", "@jupyterlab", "builder", "lib", "build-labextension.js"
|