jupyter-builder 0.1.0a2__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.
Files changed (46) hide show
  1. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/.licenserc.yaml +1 -0
  2. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/.pre-commit-config.yaml +6 -5
  3. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/.prettierignore +2 -0
  4. jupyter_builder-0.1.0a4/CHANGELOG.md +89 -0
  5. jupyter_builder-0.1.0a4/PKG-INFO +175 -0
  6. jupyter_builder-0.1.0a4/README.md +103 -0
  7. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/__init__.py +1 -1
  8. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/base_extension_app.py +1 -3
  9. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/commands.py +6 -9
  10. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/debug_log_file_mixin.py +7 -7
  11. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/extension_commands/build.py +4 -4
  12. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/extension_commands/develop.py +2 -2
  13. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/extension_commands/watch.py +4 -4
  14. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/federated_extensions.py +36 -43
  15. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/federated_extensions_requirements.py +12 -12
  16. jupyter_builder-0.1.0a4/jupyter_builder/jupyterlab_semver.py +1219 -0
  17. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/yarn.js +8 -13
  18. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/package.json +29 -3
  19. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/pyproject.toml +23 -11
  20. jupyter_builder-0.1.0a4/src/build-labextension.ts +149 -0
  21. jupyter_builder-0.1.0a4/src/build.ts +281 -0
  22. jupyter_builder-0.1.0a4/src/duplicate-package-checker-webpack-plugin.d.ts +64 -0
  23. jupyter_builder-0.1.0a4/src/extensionConfig.ts +307 -0
  24. jupyter_builder-0.1.0a4/src/index.ts +7 -0
  25. jupyter_builder-0.1.0a4/src/metadata_schema.json +119 -0
  26. jupyter_builder-0.1.0a4/src/mini-css-extract-plugin.d.ts +8 -0
  27. jupyter_builder-0.1.0a4/src/webpack-plugins.ts +256 -0
  28. jupyter_builder-0.1.0a4/src/webpack.config.base.ts +90 -0
  29. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/tests/test_tpl.py +45 -6
  30. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/tsconfig.json +8 -4
  31. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/yarn.lock +1331 -24
  32. jupyter_builder-0.1.0a2/CHANGELOG.md +0 -40
  33. jupyter_builder-0.1.0a2/PKG-INFO +0 -119
  34. jupyter_builder-0.1.0a2/README.md +0 -48
  35. jupyter_builder-0.1.0a2/jupyter_builder/jupyterlab_semver.py +0 -252
  36. jupyter_builder-0.1.0a2/jupyter_builder/jupyterlab_server_req.py +0 -66
  37. jupyter_builder-0.1.0a2/src/index.ts +0 -6
  38. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/.copier-answers.yml +0 -0
  39. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/.gitignore +0 -0
  40. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/.yarnrc.yml +0 -0
  41. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/LICENSE +0 -0
  42. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/RELEASE.md +0 -0
  43. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/core_path.py +0 -0
  44. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/extension_commands/__init__.py +0 -0
  45. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/jlpm.py +0 -0
  46. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a4}/jupyter_builder/main.py +0 -0
@@ -20,5 +20,6 @@ header:
20
20
  - node_modules/**
21
21
  - node_modules/.**
22
22
  - 'yarn.lock'
23
+ - 'jupyter_builder/yarn.js'
23
24
 
24
25
  comment: on-failure
@@ -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,11 +58,11 @@ repos:
57
58
  ["traitlets>=5.13"]
58
59
 
59
60
  - repo: https://github.com/astral-sh/ruff-pre-commit
60
- rev: v0.3.4
61
+ rev: v0.9.4
61
62
  hooks:
62
- # - id: ruff
63
- # types_or: [python, jupyter]
64
- # args: ["--fix", "--show-fixes"]
63
+ - id: ruff
64
+ types_or: [python, jupyter]
65
+ args: ["--fix", "--show-fixes"]
65
66
  - id: ruff-format
66
67
  types_or: [python, jupyter]
67
68
 
@@ -4,3 +4,5 @@ node_modules
4
4
  **/package.json
5
5
  !/package.json
6
6
  jupyter_builder
7
+ *.md
8
+ jupyter_builder/yarn.js
@@ -0,0 +1,89 @@
1
+ # Changelog
2
+
3
+ <!-- <START NEW CHANGELOG ENTRY> -->
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
+
42
+ ## 0.1.0a3
43
+
44
+ ([Full Changelog](https://github.com/jupyterlab/jupyter-builder/compare/v0.1.0a2...464a12d6a8288e06646f0c364ee1477d643c7261))
45
+
46
+ ### Maintenance and upkeep improvements
47
+
48
+ - Bump ruff from 0.4.7 to 0.5.5 in the pip group across 1 directory [#24](https://github.com/jupyterlab/jupyter-builder/pull/24) ([@dependabot](https://github.com/dependabot))
49
+
50
+ ### Contributors to this release
51
+
52
+ ([GitHub contributors page for this release](https://github.com/jupyterlab/jupyter-builder/graphs/contributors?from=2024-07-29&to=2024-07-30&type=c))
53
+
54
+ [@dependabot](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Adependabot+updated%3A2024-07-29..2024-07-30&type=Issues)
55
+
56
+ ## 0.1.0a2
57
+
58
+ ([Full Changelog](https://github.com/jupyterlab/jupyter-builder/compare/ac6bb51518d309b96658dc45784f4d47a7cd559c...02764ce51fd919bdb5739e06d545656ee0e5b2c9))
59
+
60
+ ### Enhancements made
61
+
62
+ - Include jlpm within this package (Issue #15) [#20](https://github.com/jupyterlab/jupyter-builder/pull/20) ([@cronan03](https://github.com/cronan03))
63
+ - Watch feature and tests [#18](https://github.com/jupyterlab/jupyter-builder/pull/18) ([@cronan03](https://github.com/cronan03))
64
+ - Build feature and Tests [#13](https://github.com/jupyterlab/jupyter-builder/pull/13) ([@cronan03](https://github.com/cronan03))
65
+ - Develop command working [#11](https://github.com/jupyterlab/jupyter-builder/pull/11) ([@cronan03](https://github.com/cronan03))
66
+
67
+ ### Bugs fixed
68
+
69
+ - Comment npm related release hook [#25](https://github.com/jupyterlab/jupyter-builder/pull/25) ([@fcollonval](https://github.com/fcollonval))
70
+
71
+ ### Maintenance and upkeep improvements
72
+
73
+ - Scaffolding for adding a npm package and setting up the releaser [#23](https://github.com/jupyterlab/jupyter-builder/pull/23) ([@fcollonval](https://github.com/fcollonval))
74
+ - Bump ruff from 0.4.2 to 0.4.7 in the pip group [#9](https://github.com/jupyterlab/jupyter-builder/pull/9) ([@dependabot](https://github.com/dependabot))
75
+ - Bump ruff from 0.3.4 to 0.4.2 in the pip group [#7](https://github.com/jupyterlab/jupyter-builder/pull/7) ([@dependabot](https://github.com/dependabot))
76
+ - Bump apache/skywalking-eyes from 97538682f556b56cc7422ece660d8d7e6c4fb013 to cd7b195c51fd3d6ad52afceb760719ddc6b3ee91 in the actions group [#6](https://github.com/jupyterlab/jupyter-builder/pull/6) ([@dependabot](https://github.com/dependabot))
77
+ - Bump the pip group with 1 update [#5](https://github.com/jupyterlab/jupyter-builder/pull/5) ([@dependabot](https://github.com/dependabot))
78
+ - Bump the actions group with 1 update [#4](https://github.com/jupyterlab/jupyter-builder/pull/4) ([@dependabot](https://github.com/dependabot))
79
+ - Add skeleton [#2](https://github.com/jupyterlab/jupyter-builder/pull/2) ([@fcollonval](https://github.com/fcollonval))
80
+
81
+ ### Documentation improvements
82
+
83
+ - Documentation [#22](https://github.com/jupyterlab/jupyter-builder/pull/22) ([@cronan03](https://github.com/cronan03))
84
+
85
+ ### Contributors to this release
86
+
87
+ ([GitHub contributors page for this release](https://github.com/jupyterlab/jupyter-builder/graphs/contributors?from=2024-03-04&to=2024-07-29&type=c))
88
+
89
+ [@cronan03](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Acronan03+updated%3A2024-03-04..2024-07-29&type=Issues) | [@dependabot](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Adependabot+updated%3A2024-03-04..2024-07-29&type=Issues) | [@fcollonval](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Afcollonval+updated%3A2024-03-04..2024-07-29&type=Issues) | [@kloczek](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Akloczek+updated%3A2024-03-04..2024-07-29&type=Issues) | [@welcome](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Awelcome+updated%3A2024-03-04..2024-07-29&type=Issues)
@@ -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.
@@ -9,5 +9,5 @@ except ImportError:
9
9
  # the package from a stable release or in editable mode: https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
10
10
  import warnings
11
11
 
12
- warnings.warn("Importing 'jupyter_builder' outside a proper installation.")
12
+ warnings.warn("Importing 'jupyter_builder' outside a proper installation.", stacklevel=1)
13
13
  __version__ = "dev"
@@ -4,6 +4,7 @@
4
4
  # Distributed under the terms of the Modified BSD License.
5
5
 
6
6
  from __future__ import annotations
7
+
7
8
  import os
8
9
  from copy import copy
9
10
 
@@ -15,9 +16,6 @@ from .debug_log_file_mixin import DebugLogFileMixin
15
16
 
16
17
  HERE = os.path.dirname(os.path.abspath(__file__))
17
18
 
18
-
19
- # from .federated_labextensions import build_labextension, develop_labextension_py, watch_labextension
20
-
21
19
  flags = dict(base_flags)
22
20
 
23
21
  develop_flags = copy(flags)
@@ -41,7 +41,8 @@ def _compare_ranges(spec1, spec2, drop_prerelease1=False, drop_prerelease2=False
41
41
  # Set return_value to a sentinel value
42
42
  return_value = False
43
43
 
44
- # r1.set may be a list of ranges if the range involved an ||, so we need to test for overlaps between each pair.
44
+ # r1.set may be a list of ranges if the range involved an ||,
45
+ # so we need to test for overlaps between each pair.
45
46
  for r1set, r2set in itertools.product(r1.set, r2.set):
46
47
  x1 = r1set[0].semver
47
48
  x2 = r1set[-1].semver
@@ -78,14 +79,10 @@ def _compare_ranges(spec1, spec2, drop_prerelease1=False, drop_prerelease2=False
78
79
 
79
80
  # Check for overlap.
80
81
  if (
81
- gte(x1, y1, True)
82
- and ly(x1, y2, True)
83
- or gy(x2, y1, True)
84
- and ly(x2, y2, True)
85
- or gte(y1, x1, True)
86
- and lx(y1, x2, True)
87
- or gx(y2, x1, True)
88
- 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))
89
86
  ):
90
87
  # if we ever find an overlap, we can return immediately
91
88
  return 0
@@ -47,18 +47,18 @@ class DebugLogFileMixin(Configurable):
47
47
  for line in msg:
48
48
  self.log.debug(line)
49
49
  if isinstance(ex, SystemExit):
50
- warnings.warn(f"An error occurred. See the log file for details: {log_path}")
50
+ warnings.warn(
51
+ f"An error occurred. See the log file for details: {log_path}", stacklevel=1
52
+ )
51
53
  raise
52
- warnings.warn("An error occurred.")
53
- warnings.warn(msg[-1].strip())
54
- warnings.warn(f"See the log file for details: {log_path}")
54
+ warnings.warn("An error occurred.", stacklevel=1)
55
+ warnings.warn(msg[-1].strip(), stacklevel=1)
56
+ warnings.warn(f"See the log file for details: {log_path}", stacklevel=1)
55
57
  self.exit(1)
56
58
  else:
57
59
  log.removeHandler(_debug_handler)
58
60
  _debug_handler.flush()
59
61
  _debug_handler.close()
60
- try:
62
+ with contextlib.suppress(FileNotFoundError):
61
63
  os.remove(log_path)
62
- except FileNotFoundError:
63
- pass
64
64
  log.removeHandler(_debug_handler)
@@ -5,9 +5,9 @@ import os
5
5
 
6
6
  from traitlets import Bool, Unicode
7
7
 
8
- from ..base_extension_app import BaseExtensionApp
9
- from ..core_path import default_core_path
10
- from ..federated_extensions import build_labextension
8
+ from jupyter_builder.base_extension_app import BaseExtensionApp
9
+ from jupyter_builder.core_path import default_core_path
10
+ from jupyter_builder.federated_extensions import build_labextension
11
11
 
12
12
  HERE = os.path.dirname(os.path.abspath(__file__))
13
13
 
@@ -27,7 +27,7 @@ class BuildLabExtensionApp(BaseExtensionApp):
27
27
  help="Directory containing core application package.json file",
28
28
  )
29
29
 
30
- aliases = {
30
+ aliases = { # noqa: RUF012
31
31
  "static-url": "BuildLabExtensionApp.static_url",
32
32
  "development": "BuildLabExtensionApp.development",
33
33
  "source-map": "BuildLabExtensionApp.source_map",
@@ -7,8 +7,8 @@ from copy import copy
7
7
  from jupyter_core.application import base_flags
8
8
  from traitlets import Bool, Unicode
9
9
 
10
- from ..base_extension_app import BaseExtensionApp
11
- from ..federated_extensions import develop_labextension_py
10
+ from jupyter_builder.base_extension_app import BaseExtensionApp
11
+ from jupyter_builder.federated_extensions import develop_labextension_py
12
12
 
13
13
  flags = dict(base_flags)
14
14
  develop_flags = copy(flags)
@@ -5,9 +5,9 @@ import os
5
5
 
6
6
  from traitlets import Bool, Unicode
7
7
 
8
- from ..base_extension_app import BaseExtensionApp
9
- from ..federated_extensions import watch_labextension
10
- from ..core_path import default_core_path
8
+ from jupyter_builder.base_extension_app import BaseExtensionApp
9
+ from jupyter_builder.core_path import default_core_path
10
+ from jupyter_builder.federated_extensions import watch_labextension
11
11
 
12
12
  HERE = os.path.dirname(os.path.abspath(__file__))
13
13
 
@@ -25,7 +25,7 @@ class WatchLabExtensionApp(BaseExtensionApp):
25
25
  help="Directory containing core application package.json file",
26
26
  )
27
27
 
28
- aliases = {
28
+ aliases = { # noqa: RUF012
29
29
  "core-path": "WatchLabExtensionApp.core_path",
30
30
  "development": "WatchLabExtensionApp.development",
31
31
  "source-map": "WatchLabExtensionApp.source_map",