jupyterlab-chat 0.6.0__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 (71) hide show
  1. jupyterlab_chat-0.6.0/.copier-answers.yml +19 -0
  2. jupyterlab_chat-0.6.0/.gitignore +131 -0
  3. jupyterlab_chat-0.6.0/.prettierignore +6 -0
  4. jupyterlab_chat-0.6.0/CHANGELOG.md +5 -0
  5. jupyterlab_chat-0.6.0/LICENSE +29 -0
  6. jupyterlab_chat-0.6.0/PKG-INFO +187 -0
  7. jupyterlab_chat-0.6.0/README.md +122 -0
  8. jupyterlab_chat-0.6.0/RELEASE.md +111 -0
  9. jupyterlab_chat-0.6.0/install.json +5 -0
  10. jupyterlab_chat-0.6.0/jupyter-config/server-config/jupyterlab_collaborative_chat.json +7 -0
  11. jupyterlab_chat-0.6.0/jupyterlab_chat/__init__.py +36 -0
  12. jupyterlab_chat-0.6.0/jupyterlab_chat/_version.py +4 -0
  13. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/package.json +242 -0
  14. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/schemas/jupyterlab-chat-extension/chat-panel.json +19 -0
  15. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/schemas/jupyterlab-chat-extension/commands.json +36 -0
  16. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/schemas/jupyterlab-chat-extension/factory.json +110 -0
  17. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/schemas/jupyterlab-chat-extension/package.json.orig +237 -0
  18. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/static/36.bc3ca9f4cb4811c15cc1.js +1 -0
  19. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/static/432.9f5233502df456f9977f.js +1 -0
  20. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/static/507.22224069f238a26bcd6f.js +1 -0
  21. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/static/509.2221dc26978b288af3a8.js +1 -0
  22. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/static/77.8624cf6921d05788f8f4.js +1 -0
  23. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/static/848.84a7c43fca45f3293ca5.js +75 -0
  24. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/static/848.84a7c43fca45f3293ca5.js.LICENSE.txt +28 -0
  25. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/static/remoteEntry.8445e74c6c89dbc0ffd7.js +1 -0
  26. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/static/style.js +4 -0
  27. jupyterlab_chat-0.6.0/jupyterlab_chat/labextension/static/third-party-licenses.json +214 -0
  28. jupyterlab_chat-0.6.0/jupyterlab_chat/tests/__init__.py +4 -0
  29. jupyterlab_chat-0.6.0/jupyterlab_chat/tests/test_ychat.py +111 -0
  30. jupyterlab_chat-0.6.0/jupyterlab_chat/ychat.py +297 -0
  31. jupyterlab_chat-0.6.0/package.json +237 -0
  32. jupyterlab_chat-0.6.0/pyproject.toml +95 -0
  33. jupyterlab_chat-0.6.0/schema/chat-panel.json +19 -0
  34. jupyterlab_chat-0.6.0/schema/commands.json +36 -0
  35. jupyterlab_chat-0.6.0/schema/factory.json +110 -0
  36. jupyterlab_chat-0.6.0/screenshot.gif +0 -0
  37. jupyterlab_chat-0.6.0/setup.py +4 -0
  38. jupyterlab_chat-0.6.0/src/index.ts +739 -0
  39. jupyterlab_chat-0.6.0/style/base.css +12 -0
  40. jupyterlab_chat-0.6.0/style/index.css +6 -0
  41. jupyterlab_chat-0.6.0/style/index.js +6 -0
  42. jupyterlab_chat-0.6.0/tsconfig.json +8 -0
  43. jupyterlab_chat-0.6.0/ui-tests/README.md +167 -0
  44. jupyterlab_chat-0.6.0/ui-tests/jupyter_server_test_config.py +17 -0
  45. jupyterlab_chat-0.6.0/ui-tests/package.json +16 -0
  46. jupyterlab_chat-0.6.0/ui-tests/playwright.config.js +24 -0
  47. jupyterlab_chat-0.6.0/ui-tests/tests/autocompletion.spec.ts +345 -0
  48. jupyterlab_chat-0.6.0/ui-tests/tests/chat-file.spec.ts +287 -0
  49. jupyterlab_chat-0.6.0/ui-tests/tests/code-toolbar.spec.ts +237 -0
  50. jupyterlab_chat-0.6.0/ui-tests/tests/commands.spec.ts +131 -0
  51. jupyterlab_chat-0.6.0/ui-tests/tests/commands.spec.ts-snapshots/launcher-tile-linux.png +0 -0
  52. jupyterlab_chat-0.6.0/ui-tests/tests/commands.spec.ts-snapshots/menu-new-linux.png +0 -0
  53. jupyterlab_chat-0.6.0/ui-tests/tests/message-toolbar.spec.ts +148 -0
  54. jupyterlab_chat-0.6.0/ui-tests/tests/notifications.spec.ts +214 -0
  55. jupyterlab_chat-0.6.0/ui-tests/tests/notifications.spec.ts-snapshots/tab-with-unread-linux.png +0 -0
  56. jupyterlab_chat-0.6.0/ui-tests/tests/notifications.spec.ts-snapshots/tab-without-unread-linux.png +0 -0
  57. jupyterlab_chat-0.6.0/ui-tests/tests/raw-time.spec.ts +89 -0
  58. jupyterlab_chat-0.6.0/ui-tests/tests/send-message.spec.ts +250 -0
  59. jupyterlab_chat-0.6.0/ui-tests/tests/side-panel.spec.ts +373 -0
  60. jupyterlab_chat-0.6.0/ui-tests/tests/side-panel.spec.ts-snapshots/chat-icon-linux.png +0 -0
  61. jupyterlab_chat-0.6.0/ui-tests/tests/side-panel.spec.ts-snapshots/moveToMain-linux.png +0 -0
  62. jupyterlab_chat-0.6.0/ui-tests/tests/side-panel.spec.ts-snapshots/moveToSide-linux.png +0 -0
  63. jupyterlab_chat-0.6.0/ui-tests/tests/test-utils.ts +122 -0
  64. jupyterlab_chat-0.6.0/ui-tests/tests/ui-config.spec.ts +314 -0
  65. jupyterlab_chat-0.6.0/ui-tests/tests/ui-config.spec.ts-snapshots/not-stacked-messages-linux.png +0 -0
  66. jupyterlab_chat-0.6.0/ui-tests/tests/ui-config.spec.ts-snapshots/stacked-messages-linux.png +0 -0
  67. jupyterlab_chat-0.6.0/ui-tests/tests/unread.spec.ts +435 -0
  68. jupyterlab_chat-0.6.0/ui-tests/tests/unread.spec.ts-snapshots/navigation-bottom-linux.png +0 -0
  69. jupyterlab_chat-0.6.0/ui-tests/tests/unread.spec.ts-snapshots/navigation-bottom-unread-linux.png +0 -0
  70. jupyterlab_chat-0.6.0/ui-tests/tests/unread.spec.ts-snapshots/navigation-top-linux.png +0 -0
  71. jupyterlab_chat-0.6.0/ui-tests/yarn.lock +4283 -0
@@ -0,0 +1,19 @@
1
+ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2
+ _commit: v4.2.5
3
+ _src_path: https://github.com/jupyterlab/extension-template
4
+ author_email: jupyter@googlegroups.com
5
+ author_name: Jupyter Development Team
6
+ data_format: string
7
+ file_extension: ''
8
+ has_binder: true
9
+ has_settings: true
10
+ kind: server
11
+ labextension_name: jupyterlab-chat-extension
12
+ mimetype: ''
13
+ mimetype_name: ''
14
+ project_short_description: A chat extension based on shared documents
15
+ python_name: jupyterlab_chat
16
+ repository: https://github.com/jupyterlab/jupyter-chat
17
+ test: true
18
+ viewer_name: ''
19
+
@@ -0,0 +1,131 @@
1
+ *.bundle.*
2
+ lib/
3
+ node_modules/
4
+ *.log
5
+ .eslintcache
6
+ .stylelintcache
7
+ *.egg-info/
8
+ .ipynb_checkpoints
9
+ *.tsbuildinfo
10
+ .jupyter_ystore.db
11
+ labextension
12
+
13
+ # Version file is handled by hatchling
14
+ python/**/_version.py
15
+
16
+ # jest test reports
17
+ packages/jupyter-chat/junit.xml
18
+ packages/jupyterlab-chat/junit.xml
19
+
20
+ # Integration tests
21
+ python/jupyterlab-chat/ui-tests/test-results/
22
+ python/jupyterlab-chat/ui-tests/playwright-report/
23
+
24
+ # Created by https://www.gitignore.io/api/python
25
+ # Edit at https://www.gitignore.io/?templates=python
26
+
27
+ ### Python ###
28
+ # Byte-compiled / optimized / DLL files
29
+ __pycache__/
30
+ *.py[cod]
31
+ *$py.class
32
+
33
+ # C extensions
34
+ *.so
35
+
36
+ # Distribution / packaging
37
+ .Python
38
+ build/
39
+ develop-eggs/
40
+ dist/
41
+ downloads/
42
+ eggs/
43
+ .eggs/
44
+ lib/
45
+ lib64/
46
+ parts/
47
+ sdist/
48
+ var/
49
+ wheels/
50
+ pip-wheel-metadata/
51
+ share/python-wheels/
52
+ .installed.cfg
53
+ *.egg
54
+ MANIFEST
55
+
56
+ # PyInstaller
57
+ # Usually these files are written by a python script from a template
58
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
59
+ *.manifest
60
+ *.spec
61
+
62
+ # Installer logs
63
+ pip-log.txt
64
+ pip-delete-this-directory.txt
65
+
66
+ # Unit test / coverage reports
67
+ htmlcov/
68
+ .tox/
69
+ .nox/
70
+ .coverage
71
+ .coverage.*
72
+ .cache
73
+ nosetests.xml
74
+ coverage/
75
+ coverage.xml
76
+ *.cover
77
+ .hypothesis/
78
+ .pytest_cache/
79
+
80
+ # Translations
81
+ *.mo
82
+ *.pot
83
+
84
+ # Scrapy stuff:
85
+ .scrapy
86
+
87
+ # Sphinx documentation
88
+ docs/_build/
89
+
90
+ # PyBuilder
91
+ target/
92
+
93
+ # pyenv
94
+ .python-version
95
+
96
+ # celery beat schedule file
97
+ celerybeat-schedule
98
+
99
+ # SageMath parsed files
100
+ *.sage.py
101
+
102
+ # Spyder project settings
103
+ .spyderproject
104
+ .spyproject
105
+
106
+ # Rope project settings
107
+ .ropeproject
108
+
109
+ # Mr Developer
110
+ .mr.developer.cfg
111
+ .project
112
+ .pydevproject
113
+
114
+ # mkdocs documentation
115
+ /site
116
+
117
+ # mypy
118
+ .mypy_cache/
119
+ .dmypy.json
120
+ dmypy.json
121
+
122
+ # Pyre type checker
123
+ .pyre/
124
+
125
+ # End of https://www.gitignore.io/api/python
126
+
127
+ # OSX files
128
+ .DS_Store
129
+
130
+ # Yarn cache
131
+ .yarn/
@@ -0,0 +1,6 @@
1
+ node_modules
2
+ **/node_modules
3
+ **/lib
4
+ **/package.json
5
+ !/package.json
6
+ jupyterlab_chat
@@ -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) 2024, Jupyter Development Team
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,187 @@
1
+ Metadata-Version: 2.3
2
+ Name: jupyterlab_chat
3
+ Version: 0.6.0
4
+ Dynamic: Keywords
5
+ Summary: A chat extension based on shared documents
6
+ Project-URL: Homepage, https://github.com/jupyterlab/jupyter-chat
7
+ Project-URL: Bug Tracker, https://github.com/jupyterlab/jupyter-chat/issues
8
+ Project-URL: Repository, https://github.com/jupyterlab/jupyter-chat.git
9
+ Author-email: Jupyter Development Team <jupyter@googlegroups.com>
10
+ License: BSD 3-Clause License
11
+
12
+ Copyright (c) 2024, Jupyter Development Team
13
+ All rights reserved.
14
+
15
+ Redistribution and use in source and binary forms, with or without
16
+ modification, are permitted provided that the following conditions are met:
17
+
18
+ 1. Redistributions of source code must retain the above copyright notice, this
19
+ list of conditions and the following disclaimer.
20
+
21
+ 2. Redistributions in binary form must reproduce the above copyright notice,
22
+ this list of conditions and the following disclaimer in the documentation
23
+ and/or other materials provided with the distribution.
24
+
25
+ 3. Neither the name of the copyright holder nor the names of its
26
+ contributors may be used to endorse or promote products derived from
27
+ this software without specific prior written permission.
28
+
29
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
30
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
33
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
+ Classifier: Framework :: Jupyter
40
+ Classifier: Framework :: Jupyter :: JupyterLab
41
+ Classifier: Framework :: Jupyter :: JupyterLab :: 4
42
+ Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
43
+ Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
44
+ Classifier: License :: OSI Approved :: BSD License
45
+ Classifier: Programming Language :: Python
46
+ Classifier: Programming Language :: Python :: 3
47
+ Classifier: Programming Language :: Python :: 3.8
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
+ Requires-Python: >=3.8
53
+ Requires-Dist: jupyter-collaboration<3,>=2.1.4
54
+ Requires-Dist: jupyter-server<3,>=2.0.1
55
+ Requires-Dist: jupyter-ydoc
56
+ Requires-Dist: jupyterlab~=4.0
57
+ Requires-Dist: pycrdt
58
+ Provides-Extra: test
59
+ Requires-Dist: coverage; extra == 'test'
60
+ Requires-Dist: pytest; extra == 'test'
61
+ Requires-Dist: pytest-asyncio; extra == 'test'
62
+ Requires-Dist: pytest-cov; extra == 'test'
63
+ Requires-Dist: pytest-jupyter[server]>=0.6.0; extra == 'test'
64
+ Description-Content-Type: text/markdown
65
+
66
+ # jupyterlab_chat
67
+
68
+ [![Github Actions Status](https://github.com/jupyterlab/jupyter-chat/workflows/Build/badge.svg)](https://github.com/jupyterlab/jupyter-chat/actions/workflows/build.yml)[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyterlab/jupyter-chat/main?urlpath=lab)
69
+
70
+ A chat extension based on shared documents.
71
+
72
+ This extension is composed of a Python package named `jupyterlab_chat`
73
+ for the server extension and a NPM package named `jupyterlab-chat-extension`
74
+ for the frontend extension.
75
+
76
+ This extension registers a `YChat` shared document, and associate the document to a
77
+ chat widget in the front end.
78
+
79
+ ![screenshot](screenshot.gif 'jupyterlab chat extension')
80
+
81
+ ## Requirements
82
+
83
+ - JupyterLab >= 4.0.0
84
+
85
+ ## Install
86
+
87
+ To install the extension, execute:
88
+
89
+ ```bash
90
+ pip install jupyterlab_chat
91
+ ```
92
+
93
+ ## Uninstall
94
+
95
+ To remove the extension, execute:
96
+
97
+ ```bash
98
+ pip uninstall jupyterlab_chat
99
+ ```
100
+
101
+ ## Troubleshoot
102
+
103
+ If you are seeing the frontend extension, but it is not working, check
104
+ that the server extension is enabled:
105
+
106
+ ```bash
107
+ jupyter server extension list
108
+ ```
109
+
110
+ If the server extension is installed and enabled, but you are not seeing
111
+ the frontend extension, check the frontend extension is installed:
112
+
113
+ ```bash
114
+ jupyter labextension list
115
+ ```
116
+
117
+ ## Contributing
118
+
119
+ ### Development install
120
+
121
+ Note: You will need NodeJS to build the extension package.
122
+
123
+ The `jlpm` command is JupyterLab's pinned version of
124
+ [yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
125
+ `yarn` or `npm` in lieu of `jlpm` below.
126
+
127
+ ```bash
128
+ # Clone the repo to your local environment
129
+ # Change directory to the jupyterlab_chat directory
130
+ # Install package in development mode
131
+ pip install -e ".[test]"
132
+ # Link your development version of the extension with JupyterLab
133
+ jupyter labextension develop . --overwrite
134
+ # Rebuild extension Typescript source after making changes
135
+ jlpm build
136
+ ```
137
+
138
+ 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.
139
+
140
+ ```bash
141
+ # Watch the source directory in one terminal, automatically rebuilding when needed
142
+ jlpm watch
143
+ # Run JupyterLab in another terminal
144
+ jupyter lab
145
+ ```
146
+
147
+ 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).
148
+
149
+ 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:
150
+
151
+ ```bash
152
+ jupyter lab build --minimize=False
153
+ ```
154
+
155
+ ### Development uninstall
156
+
157
+ ```bash
158
+ pip uninstall jupyterlab_chat
159
+ ```
160
+
161
+ In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
162
+ command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
163
+ folder is located. Then you can remove the symlink named `jupyterlab-chat-extension` within that folder.
164
+
165
+ ### Testing the extension
166
+
167
+ #### Frontend tests
168
+
169
+ This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.
170
+
171
+ To execute them, execute:
172
+
173
+ ```sh
174
+ jlpm
175
+ jlpm test
176
+ ```
177
+
178
+ #### Integration tests
179
+
180
+ This extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).
181
+ More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.
182
+
183
+ More information are provided within the [ui-tests](./ui-tests/README.md) README.
184
+
185
+ ### Packaging the extension
186
+
187
+ See [RELEASE](RELEASE.md)
@@ -0,0 +1,122 @@
1
+ # jupyterlab_chat
2
+
3
+ [![Github Actions Status](https://github.com/jupyterlab/jupyter-chat/workflows/Build/badge.svg)](https://github.com/jupyterlab/jupyter-chat/actions/workflows/build.yml)[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyterlab/jupyter-chat/main?urlpath=lab)
4
+
5
+ A chat extension based on shared documents.
6
+
7
+ This extension is composed of a Python package named `jupyterlab_chat`
8
+ for the server extension and a NPM package named `jupyterlab-chat-extension`
9
+ for the frontend extension.
10
+
11
+ This extension registers a `YChat` shared document, and associate the document to a
12
+ chat widget in the front end.
13
+
14
+ ![screenshot](screenshot.gif 'jupyterlab chat extension')
15
+
16
+ ## Requirements
17
+
18
+ - JupyterLab >= 4.0.0
19
+
20
+ ## Install
21
+
22
+ To install the extension, execute:
23
+
24
+ ```bash
25
+ pip install jupyterlab_chat
26
+ ```
27
+
28
+ ## Uninstall
29
+
30
+ To remove the extension, execute:
31
+
32
+ ```bash
33
+ pip uninstall jupyterlab_chat
34
+ ```
35
+
36
+ ## Troubleshoot
37
+
38
+ If you are seeing the frontend extension, but it is not working, check
39
+ that the server extension is enabled:
40
+
41
+ ```bash
42
+ jupyter server extension list
43
+ ```
44
+
45
+ If the server extension is installed and enabled, but you are not seeing
46
+ the frontend extension, check the frontend extension is installed:
47
+
48
+ ```bash
49
+ jupyter labextension list
50
+ ```
51
+
52
+ ## Contributing
53
+
54
+ ### Development install
55
+
56
+ Note: You will need NodeJS to build the extension package.
57
+
58
+ The `jlpm` command is JupyterLab's pinned version of
59
+ [yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
60
+ `yarn` or `npm` in lieu of `jlpm` below.
61
+
62
+ ```bash
63
+ # Clone the repo to your local environment
64
+ # Change directory to the jupyterlab_chat directory
65
+ # Install package in development mode
66
+ pip install -e ".[test]"
67
+ # Link your development version of the extension with JupyterLab
68
+ jupyter labextension develop . --overwrite
69
+ # Rebuild extension Typescript source after making changes
70
+ jlpm build
71
+ ```
72
+
73
+ 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.
74
+
75
+ ```bash
76
+ # Watch the source directory in one terminal, automatically rebuilding when needed
77
+ jlpm watch
78
+ # Run JupyterLab in another terminal
79
+ jupyter lab
80
+ ```
81
+
82
+ 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).
83
+
84
+ 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:
85
+
86
+ ```bash
87
+ jupyter lab build --minimize=False
88
+ ```
89
+
90
+ ### Development uninstall
91
+
92
+ ```bash
93
+ pip uninstall jupyterlab_chat
94
+ ```
95
+
96
+ In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
97
+ command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
98
+ folder is located. Then you can remove the symlink named `jupyterlab-chat-extension` within that folder.
99
+
100
+ ### Testing the extension
101
+
102
+ #### Frontend tests
103
+
104
+ This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.
105
+
106
+ To execute them, execute:
107
+
108
+ ```sh
109
+ jlpm
110
+ jlpm test
111
+ ```
112
+
113
+ #### Integration tests
114
+
115
+ This extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).
116
+ More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.
117
+
118
+ More information are provided within the [ui-tests](./ui-tests/README.md) README.
119
+
120
+ ### Packaging the extension
121
+
122
+ See [RELEASE](RELEASE.md)
@@ -0,0 +1,111 @@
1
+ # Making a new release of jupyterlab_chat
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.
62
+
63
+ Check out the [workflow documentation](https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html) for more information.
64
+
65
+ Here is a summary of the steps to cut a new release:
66
+
67
+ - Add tokens to the [Github Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) in the repository:
68
+ - `ADMIN_GITHUB_TOKEN` (with "public_repo" and "repo:status" permissions); see the [documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
69
+ - `NPM_TOKEN` (with "automation" permission); see the [documentation](https://docs.npmjs.com/creating-and-viewing-access-tokens)
70
+ - Set up PyPI
71
+
72
+ <details><summary>Using PyPI trusted publisher (modern way)</summary>
73
+
74
+ - Set up your PyPI project by [adding a trusted publisher](https://docs.pypi.org/trusted-publishers/adding-a-publisher/)
75
+ - The _workflow name_ is `publish-release.yml` and the _environment_ should be left blank.
76
+ - Ensure the publish release job as `permissions`: `id-token : write` (see the [documentation](https://docs.pypi.org/trusted-publishers/using-a-publisher/))
77
+
78
+ </details>
79
+
80
+ <details><summary>Using PyPI token (legacy way)</summary>
81
+
82
+ - If the repo generates PyPI release(s), create a scoped PyPI [token](https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#saving-credentials-on-github). We recommend using a scoped token for security reasons.
83
+
84
+ - You can store the token as `PYPI_TOKEN` in your fork's `Secrets`.
85
+
86
+ - Advanced usage: if you are releasing multiple repos, you can create a secret named `PYPI_TOKEN_MAP` instead of `PYPI_TOKEN` that is formatted as follows:
87
+
88
+ ```text
89
+ owner1/repo1,token1
90
+ owner2/repo2,token2
91
+ ```
92
+
93
+ If you have multiple Python packages in the same repository, you can point to them as follows:
94
+
95
+ ```text
96
+ owner1/repo1/path/to/package1,token1
97
+ owner1/repo1/path/to/package2,token2
98
+ ```
99
+
100
+ </details>
101
+
102
+ - Go to the Actions panel
103
+ - Run the "Step 1: Prep Release" workflow
104
+ - Check the draft changelog
105
+ - Run the "Step 2: Publish Release" workflow
106
+
107
+ ## Publishing to `conda-forge`
108
+
109
+ 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
110
+
111
+ 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,5 @@
1
+ {
2
+ "packageManager": "python",
3
+ "packageName": "jupyterlab_chat",
4
+ "uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_chat"
5
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "ServerApp": {
3
+ "jpserver_extensions": {
4
+ "jupyterlab_chat": true
5
+ }
6
+ }
7
+ }
@@ -0,0 +1,36 @@
1
+ # Copyright (c) Jupyter Development Team.
2
+ # Distributed under the terms of the Modified BSD License.
3
+
4
+ try:
5
+ from ._version import __version__
6
+ except ImportError:
7
+ # Fallback when using the package in dev mode without installing
8
+ # in editable mode with pip. It is highly recommended to install
9
+ # the package from a stable release or in editable mode: https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
10
+ import warnings
11
+ warnings.warn("Importing 'jupyterlab_chat' outside a proper installation.")
12
+ __version__ = "dev"
13
+
14
+
15
+ def _jupyter_labextension_paths():
16
+ return [{
17
+ "src": "labextension",
18
+ "dest": "jupyterlab-chat-extension"
19
+ }]
20
+
21
+
22
+ def _jupyter_server_extension_points():
23
+ return [{
24
+ "module": "jupyterlab_chat"
25
+ }]
26
+
27
+
28
+ def _load_jupyter_server_extension(server_app):
29
+ """Registers the API handler to receive HTTP requests from the frontend extension.
30
+ Parameters
31
+ ----------
32
+ server_app: jupyterlab.labapp.LabApp
33
+ JupyterLab application instance
34
+ """
35
+ name = "jupyterlab_chat"
36
+ server_app.log.info(f"Registered {name} server extension")
@@ -0,0 +1,4 @@
1
+ # This file is auto-generated by Hatchling. As such, do not:
2
+ # - modify
3
+ # - track in version control e.g. be sure to add to .gitignore
4
+ __version__ = VERSION = '0.6.0'