jupyterlab-leetcode 0.1.1__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 (68) hide show
  1. jupyterlab_leetcode-0.1.1/.copier-answers.yml +14 -0
  2. jupyterlab_leetcode-0.1.1/.gitignore +127 -0
  3. jupyterlab_leetcode-0.1.1/.prettierignore +6 -0
  4. jupyterlab_leetcode-0.1.1/.yarnrc.yml +1 -0
  5. jupyterlab_leetcode-0.1.1/CHANGELOG.md +5 -0
  6. jupyterlab_leetcode-0.1.1/LICENSE +29 -0
  7. jupyterlab_leetcode-0.1.1/PKG-INFO +202 -0
  8. jupyterlab_leetcode-0.1.1/README.md +139 -0
  9. jupyterlab_leetcode-0.1.1/RELEASE.md +80 -0
  10. jupyterlab_leetcode-0.1.1/babel.config.js +1 -0
  11. jupyterlab_leetcode-0.1.1/conftest.py +8 -0
  12. jupyterlab_leetcode-0.1.1/environment.yml +10 -0
  13. jupyterlab_leetcode-0.1.1/install.json +5 -0
  14. jupyterlab_leetcode-0.1.1/jest.config.js +28 -0
  15. jupyterlab_leetcode-0.1.1/jupyter-config/server-config/jupyterlab_leetcode.json +7 -0
  16. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/__init__.py +32 -0
  17. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/_version.py +4 -0
  18. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/handlers/__init__.py +31 -0
  19. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/handlers/base_handler.py +10 -0
  20. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/handlers/cookie_handler.py +87 -0
  21. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/handlers/leetcode_handler.py +464 -0
  22. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/labextension/package.json +217 -0
  23. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/labextension/schemas/jupyterlab-leetcode/package.json.orig +212 -0
  24. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/labextension/schemas/jupyterlab-leetcode/plugin.json +8 -0
  25. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/labextension/static/266.1f3531e8ca41f032af95.js +1 -0
  26. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/labextension/static/728.369f44bbf921c6ebc9ee.js +1 -0
  27. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/labextension/static/880.2d185bdba596d2d9e8b0.js +1 -0
  28. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/labextension/static/remoteEntry.6f8397bd75fe51149f55.js +1 -0
  29. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/labextension/static/style.js +4 -0
  30. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/labextension/static/third-party-licenses.json +22 -0
  31. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/tests/__init__.py +1 -0
  32. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/tests/test_handlers.py +13 -0
  33. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/utils/notebook.template.json +111 -0
  34. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/utils/notebook_generator.py +190 -0
  35. jupyterlab_leetcode-0.1.1/jupyterlab_leetcode/utils/utils.py +9 -0
  36. jupyterlab_leetcode-0.1.1/package.json +212 -0
  37. jupyterlab_leetcode-0.1.1/pyproject.toml +90 -0
  38. jupyterlab_leetcode-0.1.1/schema/plugin.json +8 -0
  39. jupyterlab_leetcode-0.1.1/setup.py +1 -0
  40. jupyterlab_leetcode-0.1.1/src/__tests__/jupyterlab_leetcode.spec.ts +9 -0
  41. jupyterlab_leetcode-0.1.1/src/components/BrowserCookie.tsx +96 -0
  42. jupyterlab_leetcode-0.1.1/src/components/LandingPage.tsx +22 -0
  43. jupyterlab_leetcode-0.1.1/src/components/LeetCode.tsx +56 -0
  44. jupyterlab_leetcode-0.1.1/src/components/LeetCodeMainArea.tsx +35 -0
  45. jupyterlab_leetcode-0.1.1/src/components/LeetCodeNotebookHeader.tsx +24 -0
  46. jupyterlab_leetcode-0.1.1/src/components/Profile.tsx +17 -0
  47. jupyterlab_leetcode-0.1.1/src/components/QuestionItem.tsx +34 -0
  48. jupyterlab_leetcode-0.1.1/src/components/QuestionList.tsx +61 -0
  49. jupyterlab_leetcode-0.1.1/src/components/Statistics.tsx +21 -0
  50. jupyterlab_leetcode-0.1.1/src/index.ts +73 -0
  51. jupyterlab_leetcode-0.1.1/src/services/cookie.ts +9 -0
  52. jupyterlab_leetcode-0.1.1/src/services/handler.ts +46 -0
  53. jupyterlab_leetcode-0.1.1/src/services/leetcode.ts +42 -0
  54. jupyterlab_leetcode-0.1.1/src/services/notebook.ts +15 -0
  55. jupyterlab_leetcode-0.1.1/src/types/leetcode.d.ts +69 -0
  56. jupyterlab_leetcode-0.1.1/src/widget.tsx +46 -0
  57. jupyterlab_leetcode-0.1.1/style/base.css +5 -0
  58. jupyterlab_leetcode-0.1.1/style/index.css +1 -0
  59. jupyterlab_leetcode-0.1.1/style/index.js +1 -0
  60. jupyterlab_leetcode-0.1.1/tsconfig.json +25 -0
  61. jupyterlab_leetcode-0.1.1/tsconfig.test.json +3 -0
  62. jupyterlab_leetcode-0.1.1/ui-tests/README.md +167 -0
  63. jupyterlab_leetcode-0.1.1/ui-tests/jupyter_server_test_config.py +12 -0
  64. jupyterlab_leetcode-0.1.1/ui-tests/package.json +15 -0
  65. jupyterlab_leetcode-0.1.1/ui-tests/playwright.config.js +14 -0
  66. jupyterlab_leetcode-0.1.1/ui-tests/tests/jupyterlab_leetcode.spec.ts +21 -0
  67. jupyterlab_leetcode-0.1.1/ui-tests/yarn.lock +0 -0
  68. jupyterlab_leetcode-0.1.1/yarn.lock +9827 -0
@@ -0,0 +1,14 @@
1
+ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2
+ _commit: v4.3.8
3
+ _src_path: https://github.com/jupyterlab/extension-template
4
+ author_email: soros.liu1029@gmail.com
5
+ author_name: Soros Liu
6
+ has_binder: false
7
+ has_settings: true
8
+ kind: server
9
+ labextension_name: jupyterlab-leetcode
10
+ project_short_description: Integrate LeetCode into beloved Jupyter.
11
+ python_name: jupyterlab_leetcode
12
+ repository: https://github.com/Sorosliu1029/jupyterlab-leetcode
13
+ test: true
14
+
@@ -0,0 +1,127 @@
1
+ *.ipynb
2
+ .ipynb_checkpoints
3
+ *.bundle.*
4
+ lib/
5
+ node_modules/
6
+ *.log
7
+ .eslintcache
8
+ .stylelintcache
9
+ *.egg-info/
10
+ .ipynb_checkpoints
11
+ *.tsbuildinfo
12
+ jupyterlab_leetcode/labextension
13
+ # Version file is handled by hatchling
14
+ jupyterlab_leetcode/_version.py
15
+
16
+ # Integration tests
17
+ ui-tests/test-results/
18
+ ui-tests/playwright-report/
19
+
20
+ # Created by https://www.gitignore.io/api/python
21
+ # Edit at https://www.gitignore.io/?templates=python
22
+
23
+ ### Python ###
24
+ # Byte-compiled / optimized / DLL files
25
+ __pycache__/
26
+ *.py[cod]
27
+ *$py.class
28
+
29
+ # C extensions
30
+ *.so
31
+
32
+ # Distribution / packaging
33
+ .Python
34
+ build/
35
+ develop-eggs/
36
+ dist/
37
+ downloads/
38
+ eggs/
39
+ .eggs/
40
+ lib/
41
+ lib64/
42
+ parts/
43
+ sdist/
44
+ var/
45
+ wheels/
46
+ pip-wheel-metadata/
47
+ share/python-wheels/
48
+ .installed.cfg
49
+ *.egg
50
+ MANIFEST
51
+
52
+ # PyInstaller
53
+ # Usually these files are written by a python script from a template
54
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
55
+ *.manifest
56
+ *.spec
57
+
58
+ # Installer logs
59
+ pip-log.txt
60
+ pip-delete-this-directory.txt
61
+
62
+ # Unit test / coverage reports
63
+ htmlcov/
64
+ .tox/
65
+ .nox/
66
+ .coverage
67
+ .coverage.*
68
+ .cache
69
+ nosetests.xml
70
+ coverage/
71
+ coverage.xml
72
+ *.cover
73
+ .hypothesis/
74
+ .pytest_cache/
75
+
76
+ # Translations
77
+ *.mo
78
+ *.pot
79
+
80
+ # Scrapy stuff:
81
+ .scrapy
82
+
83
+ # Sphinx documentation
84
+ docs/_build/
85
+
86
+ # PyBuilder
87
+ target/
88
+
89
+ # pyenv
90
+ .python-version
91
+
92
+ # celery beat schedule file
93
+ celerybeat-schedule
94
+
95
+ # SageMath parsed files
96
+ *.sage.py
97
+
98
+ # Spyder project settings
99
+ .spyderproject
100
+ .spyproject
101
+
102
+ # Rope project settings
103
+ .ropeproject
104
+
105
+ # Mr Developer
106
+ .mr.developer.cfg
107
+ .project
108
+ .pydevproject
109
+
110
+ # mkdocs documentation
111
+ /site
112
+
113
+ # mypy
114
+ .mypy_cache/
115
+ .dmypy.json
116
+ dmypy.json
117
+
118
+ # Pyre type checker
119
+ .pyre/
120
+
121
+ # End of https://www.gitignore.io/api/python
122
+
123
+ # OSX files
124
+ .DS_Store
125
+
126
+ # Yarn cache
127
+ .yarn/
@@ -0,0 +1,6 @@
1
+ node_modules
2
+ **/node_modules
3
+ **/lib
4
+ **/package.json
5
+ !/package.json
6
+ jupyterlab_leetcode
@@ -0,0 +1 @@
1
+ nodeLinker: node-modules
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ <!-- <START NEW CHANGELOG ENTRY> -->
4
+
5
+ <!-- <END NEW CHANGELOG ENTRY> -->
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2025, Soros Liu
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,202 @@
1
+ Metadata-Version: 2.4
2
+ Name: jupyterlab_leetcode
3
+ Version: 0.1.1
4
+ Summary: Integrate LeetCode into beloved Jupyter.
5
+ Project-URL: Homepage, https://github.com/Sorosliu1029/jupyterlab-leetcode
6
+ Project-URL: Bug Tracker, https://github.com/Sorosliu1029/jupyterlab-leetcode/issues
7
+ Project-URL: Repository, https://github.com/Sorosliu1029/jupyterlab-leetcode.git
8
+ Author-email: Soros Liu <soros.liu1029@gmail.com>
9
+ License: BSD 3-Clause License
10
+
11
+ Copyright (c) 2025, Soros Liu
12
+ All rights reserved.
13
+
14
+ Redistribution and use in source and binary forms, with or without
15
+ modification, are permitted provided that the following conditions are met:
16
+
17
+ 1. Redistributions of source code must retain the above copyright notice, this
18
+ list of conditions and the following disclaimer.
19
+
20
+ 2. Redistributions in binary form must reproduce the above copyright notice,
21
+ this list of conditions and the following disclaimer in the documentation
22
+ and/or other materials provided with the distribution.
23
+
24
+ 3. Neither the name of the copyright holder nor the names of its
25
+ contributors may be used to endorse or promote products derived from
26
+ this software without specific prior written permission.
27
+
28
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
32
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
34
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
+ License-File: LICENSE
39
+ Keywords: jupyter,jupyterlab,jupyterlab-extension
40
+ Classifier: Framework :: Jupyter
41
+ Classifier: Framework :: Jupyter :: JupyterLab
42
+ Classifier: Framework :: Jupyter :: JupyterLab :: 4
43
+ Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
44
+ Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
45
+ Classifier: License :: OSI Approved :: BSD License
46
+ Classifier: Programming Language :: Python
47
+ Classifier: Programming Language :: Python :: 3
48
+ Classifier: Programming Language :: Python :: 3.9
49
+ Classifier: Programming Language :: Python :: 3.10
50
+ Classifier: Programming Language :: Python :: 3.11
51
+ Classifier: Programming Language :: Python :: 3.12
52
+ Classifier: Programming Language :: Python :: 3.13
53
+ Requires-Python: >=3.9
54
+ Requires-Dist: browser-cookie3
55
+ Requires-Dist: jupyter-server<3,>=2.4.0
56
+ Provides-Extra: test
57
+ Requires-Dist: coverage; extra == 'test'
58
+ Requires-Dist: pytest; extra == 'test'
59
+ Requires-Dist: pytest-asyncio; extra == 'test'
60
+ Requires-Dist: pytest-cov; extra == 'test'
61
+ Requires-Dist: pytest-jupyter[server]>=0.6.0; extra == 'test'
62
+ Description-Content-Type: text/markdown
63
+
64
+ # jupyterlab_leetcode
65
+
66
+ [![Github Actions Status](https://github.com/Sorosliu1029/jupyterlab-leetcode/workflows/Build/badge.svg)](https://github.com/Sorosliu1029/jupyterlab-leetcode/actions/workflows/build.yml)
67
+
68
+ Integrate LeetCode into beloved Jupyter.
69
+
70
+ This extension is composed of a Python package named `jupyterlab_leetcode`
71
+ for the server extension and a NPM package named `jupyterlab-leetcode`
72
+ for the frontend extension.
73
+
74
+ ## Requirements
75
+
76
+ - JupyterLab >= 4.0.0
77
+
78
+ ## Install
79
+
80
+ To install the extension, execute:
81
+
82
+ ```bash
83
+ pip install jupyterlab_leetcode
84
+ ```
85
+
86
+ ## Uninstall
87
+
88
+ To remove the extension, execute:
89
+
90
+ ```bash
91
+ pip uninstall jupyterlab_leetcode
92
+ ```
93
+
94
+ ## Troubleshoot
95
+
96
+ If you are seeing the frontend extension, but it is not working, check
97
+ that the server extension is enabled:
98
+
99
+ ```bash
100
+ jupyter server extension list
101
+ ```
102
+
103
+ If the server extension is installed and enabled, but you are not seeing
104
+ the frontend extension, check the frontend extension is installed:
105
+
106
+ ```bash
107
+ jupyter labextension list
108
+ ```
109
+
110
+ ## Contributing
111
+
112
+ ### Development install
113
+
114
+ Note: You will need NodeJS to build the extension package.
115
+
116
+ The `jlpm` command is JupyterLab's pinned version of
117
+ [yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
118
+ `yarn` or `npm` in lieu of `jlpm` below.
119
+
120
+ ```bash
121
+ # Clone the repo to your local environment
122
+ # Change directory to the jupyterlab_leetcode directory
123
+ # Install package in development mode
124
+ pip install -e ".[test]"
125
+ # Link your development version of the extension with JupyterLab
126
+ jupyter labextension develop . --overwrite
127
+ # Server extension must be manually installed in develop mode
128
+ jupyter server extension enable jupyterlab_leetcode
129
+ # Rebuild extension Typescript source after making changes
130
+ jlpm build
131
+ ```
132
+
133
+ 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.
134
+
135
+ ```bash
136
+ # Watch the source directory in one terminal, automatically rebuilding when needed
137
+ jlpm watch
138
+ # Run JupyterLab in another terminal
139
+ jupyter lab
140
+ ```
141
+
142
+ 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).
143
+
144
+ 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:
145
+
146
+ ```bash
147
+ jupyter lab build --minimize=False
148
+ ```
149
+
150
+ ### Development uninstall
151
+
152
+ ```bash
153
+ # Server extension must be manually disabled in develop mode
154
+ jupyter server extension disable jupyterlab_leetcode
155
+ pip uninstall jupyterlab_leetcode
156
+ ```
157
+
158
+ In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
159
+ command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
160
+ folder is located. Then you can remove the symlink named `jupyterlab-leetcode` within that folder.
161
+
162
+ ### Testing the extension
163
+
164
+ #### Server tests
165
+
166
+ This extension is using [Pytest](https://docs.pytest.org/) for Python code testing.
167
+
168
+ Install test dependencies (needed only once):
169
+
170
+ ```sh
171
+ pip install -e ".[test]"
172
+ # Each time you install the Python package, you need to restore the front-end extension link
173
+ jupyter labextension develop . --overwrite
174
+ ```
175
+
176
+ To execute them, run:
177
+
178
+ ```sh
179
+ pytest -vv -r ap --cov jupyterlab_leetcode
180
+ ```
181
+
182
+ #### Frontend tests
183
+
184
+ This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.
185
+
186
+ To execute them, execute:
187
+
188
+ ```sh
189
+ jlpm
190
+ jlpm test
191
+ ```
192
+
193
+ #### Integration tests
194
+
195
+ This extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).
196
+ More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.
197
+
198
+ More information are provided within the [ui-tests](./ui-tests/README.md) README.
199
+
200
+ ### Packaging the extension
201
+
202
+ See [RELEASE](RELEASE.md)
@@ -0,0 +1,139 @@
1
+ # jupyterlab_leetcode
2
+
3
+ [![Github Actions Status](https://github.com/Sorosliu1029/jupyterlab-leetcode/workflows/Build/badge.svg)](https://github.com/Sorosliu1029/jupyterlab-leetcode/actions/workflows/build.yml)
4
+
5
+ Integrate LeetCode into beloved Jupyter.
6
+
7
+ This extension is composed of a Python package named `jupyterlab_leetcode`
8
+ for the server extension and a NPM package named `jupyterlab-leetcode`
9
+ for the frontend extension.
10
+
11
+ ## Requirements
12
+
13
+ - JupyterLab >= 4.0.0
14
+
15
+ ## Install
16
+
17
+ To install the extension, execute:
18
+
19
+ ```bash
20
+ pip install jupyterlab_leetcode
21
+ ```
22
+
23
+ ## Uninstall
24
+
25
+ To remove the extension, execute:
26
+
27
+ ```bash
28
+ pip uninstall jupyterlab_leetcode
29
+ ```
30
+
31
+ ## Troubleshoot
32
+
33
+ If you are seeing the frontend extension, but it is not working, check
34
+ that the server extension is enabled:
35
+
36
+ ```bash
37
+ jupyter server extension list
38
+ ```
39
+
40
+ If the server extension is installed and enabled, but you are not seeing
41
+ the frontend extension, check the frontend extension is installed:
42
+
43
+ ```bash
44
+ jupyter labextension list
45
+ ```
46
+
47
+ ## Contributing
48
+
49
+ ### Development install
50
+
51
+ Note: You will need NodeJS to build the extension package.
52
+
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.
56
+
57
+ ```bash
58
+ # Clone the repo to your local environment
59
+ # Change directory to the jupyterlab_leetcode 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 jupyterlab_leetcode
66
+ # Rebuild extension Typescript source after making changes
67
+ jlpm build
68
+ ```
69
+
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.
71
+
72
+ ```bash
73
+ # Watch the source directory in one terminal, automatically rebuilding when needed
74
+ jlpm watch
75
+ # Run JupyterLab in another terminal
76
+ jupyter lab
77
+ ```
78
+
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).
80
+
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:
82
+
83
+ ```bash
84
+ jupyter lab build --minimize=False
85
+ ```
86
+
87
+ ### Development uninstall
88
+
89
+ ```bash
90
+ # Server extension must be manually disabled in develop mode
91
+ jupyter server extension disable jupyterlab_leetcode
92
+ pip uninstall jupyterlab_leetcode
93
+ ```
94
+
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 `jupyterlab-leetcode` within that folder.
98
+
99
+ ### Testing the extension
100
+
101
+ #### Server tests
102
+
103
+ This extension is using [Pytest](https://docs.pytest.org/) for Python code testing.
104
+
105
+ Install test dependencies (needed only once):
106
+
107
+ ```sh
108
+ pip install -e ".[test]"
109
+ # Each time you install the Python package, you need to restore the front-end extension link
110
+ jupyter labextension develop . --overwrite
111
+ ```
112
+
113
+ To execute them, run:
114
+
115
+ ```sh
116
+ pytest -vv -r ap --cov jupyterlab_leetcode
117
+ ```
118
+
119
+ #### Frontend tests
120
+
121
+ This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.
122
+
123
+ To execute them, execute:
124
+
125
+ ```sh
126
+ jlpm
127
+ jlpm test
128
+ ```
129
+
130
+ #### Integration tests
131
+
132
+ This extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).
133
+ More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.
134
+
135
+ More information are provided within the [ui-tests](./ui-tests/README.md) README.
136
+
137
+ ### Packaging the extension
138
+
139
+ See [RELEASE](RELEASE.md)
@@ -0,0 +1,80 @@
1
+ # Making a new release of jupyterlab_leetcode
2
+
3
+ The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser).
4
+
5
+ ## Manual release
6
+
7
+ ### Python package
8
+
9
+ This extension can be distributed as Python packages. All of the Python
10
+ packaging instructions are in the `pyproject.toml` file to wrap your extension in a
11
+ Python package. Before generating a package, you first need to install some tools:
12
+
13
+ ```bash
14
+ pip install build twine hatch
15
+ ```
16
+
17
+ Bump the version using `hatch`. By default this will create a tag.
18
+ See the docs on [hatch-nodejs-version](https://github.com/agoose77/hatch-nodejs-version#semver) for details.
19
+
20
+ ```bash
21
+ hatch version <new-version>
22
+ ```
23
+
24
+ Make sure to clean up all the development files before building the package:
25
+
26
+ ```bash
27
+ jlpm clean:all
28
+ ```
29
+
30
+ You could also clean up the local git repository:
31
+
32
+ ```bash
33
+ git clean -dfX
34
+ ```
35
+
36
+ To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in the `dist/` directory, do:
37
+
38
+ ```bash
39
+ python -m build
40
+ ```
41
+
42
+ > `python setup.py sdist bdist_wheel` is deprecated and will not work for this package.
43
+
44
+ Then to upload the package to PyPI, do:
45
+
46
+ ```bash
47
+ twine upload dist/*
48
+ ```
49
+
50
+ ### NPM package
51
+
52
+ To publish the frontend part of the extension as a NPM package, do:
53
+
54
+ ```bash
55
+ npm login
56
+ npm publish --access public
57
+ ```
58
+
59
+ ## Automated releases with the Jupyter Releaser
60
+
61
+ The extension repository should already be compatible with the Jupyter Releaser. But
62
+ the GitHub repository and the package managers need to be properly set up. Please
63
+ follow the instructions of the Jupyter Releaser [checklist](https://jupyter-releaser.readthedocs.io/en/latest/how_to_guides/convert_repo_from_repo.html).
64
+
65
+ Here is a summary of the steps to cut a new release:
66
+
67
+ - Go to the Actions panel
68
+ - Run the "Step 1: Prep Release" workflow
69
+ - Check the draft changelog
70
+ - Run the "Step 2: Publish Release" workflow
71
+
72
+ > [!NOTE]
73
+ > Check out the [workflow documentation](https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html)
74
+ > for more information.
75
+
76
+ ## Publishing to `conda-forge`
77
+
78
+ If the package is not on conda forge yet, check the documentation to learn how to add it: https://conda-forge.org/docs/maintainer/adding_pkgs.html
79
+
80
+ Otherwise a bot should pick up the new version publish to PyPI, and open a new PR on the feedstock repository automatically.
@@ -0,0 +1 @@
1
+ module.exports = require('@jupyterlab/testutils/lib/babel.config');
@@ -0,0 +1,8 @@
1
+ import pytest
2
+
3
+ pytest_plugins = ("pytest_jupyter.jupyter_server", )
4
+
5
+
6
+ @pytest.fixture
7
+ def jp_server_config(jp_server_config):
8
+ return {"ServerApp": {"jpserver_extensions": {"jupyterlab_leetcode": True}}}
@@ -0,0 +1,10 @@
1
+ name: jupyterlab-leetcode
2
+ channels:
3
+ - conda-forge
4
+ dependencies:
5
+ - jupyterlab >=4.3.0
6
+ - nodejs >=22
7
+ - pytest
8
+ - pytest-check-links
9
+ - pytest-jupyter >=0.6.0
10
+ - python=3
@@ -0,0 +1,5 @@
1
+ {
2
+ "packageManager": "python",
3
+ "packageName": "jupyterlab_leetcode",
4
+ "uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_leetcode"
5
+ }
@@ -0,0 +1,28 @@
1
+ const jestJupyterLab = require('@jupyterlab/testutils/lib/jest-config');
2
+
3
+ const esModules = [
4
+ '@codemirror',
5
+ '@jupyter/ydoc',
6
+ '@jupyterlab/',
7
+ 'lib0',
8
+ 'nanoid',
9
+ 'vscode-ws-jsonrpc',
10
+ 'y-protocols',
11
+ 'y-websocket',
12
+ 'yjs'
13
+ ].join('|');
14
+
15
+ const baseConfig = jestJupyterLab(__dirname);
16
+
17
+ module.exports = {
18
+ ...baseConfig,
19
+ automock: false,
20
+ collectCoverageFrom: [
21
+ 'src/**/*.{ts,tsx}',
22
+ '!src/**/*.d.ts',
23
+ '!src/**/.ipynb_checkpoints/*'
24
+ ],
25
+ coverageReporters: ['lcov', 'text'],
26
+ testRegex: 'src/.*/.*.spec.ts[x]?$',
27
+ transformIgnorePatterns: [`/node_modules/(?!${esModules}).+`]
28
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "ServerApp": {
3
+ "jpserver_extensions": {
4
+ "jupyterlab_leetcode": true
5
+ }
6
+ }
7
+ }