Skip to content

Commit

Permalink
Rename extension package (#8)
Browse files Browse the repository at this point in the history
* Rename the current extension package

* Add settings in extension
  • Loading branch information
brichet authored Apr 5, 2024
1 parent 0ed3730 commit 6ae629b
Show file tree
Hide file tree
Showing 44 changed files with 154 additions and 102 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ jobs:
run: jlpm build

- name: Package the extension
working-directory: packages/jupyter-chat-extension
working-directory: packages/jupyterlab-ws-chat
run: |
set -eux
pip install build
python -m build
pip uninstall -y "jupyter_chat_extension" jupyterlab
pip uninstall -y "jupyterlab_ws_chat" jupyterlab
- name: Upload project packages
uses: actions/upload-artifact@v3
with:
name: package-artifacts
path: packages/jupyter-chat-extension/dist/jupyter_chat_extension*
path: packages/jupyterlab-ws-chat/dist/jupyterlab_ws_chat*
if-no-files-found: error

check_links:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Playwright knows how to start JupyterLab server
start_server_script: 'null'
test_folder: packages/jupyter-chat-extension/ui-tests
test_folder: packages/jupyterlab-ws-chat/ui-tests
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ used by a jupyterlab extension.

### Jupyterab extension

The Jupyterlab extension is located in *packages/jupyter-chat-extension*.
The Jupyterlab extension is located in *packages/jupyterlab-ws-chat*.

It is composed of a Python package named `jupyter_chat_extension`
for the server side and a NPM package named `jupyter-chat-extension`.
It is composed of a Python package named `jupyterlab_ws_chat`
for the server side and a NPM package named `jupyterlab-ws-chat`.

This extension is an implementation of the `chat-jupyter` package, relying on
websocket for the communication between server and front end.
Expand Down
58 changes: 0 additions & 58 deletions packages/jupyter-chat-extension/src/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ node_modules/
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
jupyter_chat_extension/labextension
jupyterlab_ws_chat/labextension
# Version file is handled by hatchling
jupyter_chat_extension/_version.py
jupyterlab_ws_chat/_version.py

# Integration tests
ui-tests/test-results/
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# jupyter_chat_extension
# jupyterlab_ws_chat

[![Github Actions Status](https://github.com/jupyterlab-contrib/jupyter-chat/workflows/Build/badge.svg)](https://github.com/jupyterlab-contrib/jupyter-chat/actions/workflows/build.yml)

A chat extension for Jupyterlab

This package is composed of a Python package named `jupyter_chat_extension`
for the server side and a NPM package named `jupyter-chat-extension`
This package is composed of a Python package named `jupyterlab_ws_chat`
for the server side and a NPM package named `jupyterlab-ws-chat`

![screenshot](screenshot.png 'chat extension')

Expand All @@ -18,15 +18,15 @@ for the server side and a NPM package named `jupyter-chat-extension`
To install the package, execute:

```bash
pip install jupyter_chat_extension
pip install jupyterlab_ws_chat
```

## Uninstall

To remove the package, execute:

```bash
pip uninstall jupyter_chat_extension
pip uninstall jupyterlab_ws_chat
```

## Contributing
Expand All @@ -41,7 +41,7 @@ The `jlpm` command is JupyterLab's pinned version of

```bash
# Clone the repo to your local environment
# Change directory to the jupyter-chat/jupyter-chat-extension directory
# Change directory to the jupyter-chat/jupyterlab-ws-chat directory
# Install package in development mode
pip install -e ".[test]"
# Rebuild Typescript source after making changes
Expand All @@ -53,7 +53,7 @@ By default, the `jlpm build` command generates the source maps for this package
### Development uninstall

```bash
pip uninstall jupyter_chat_extension
pip uninstall jupyterlab_ws_chat
```

### Testing the package
Expand All @@ -71,7 +71,7 @@ pip install -e ".[test]"
To execute them, run:

```sh
pytest -vv -r ap --cov jupyter_chat_extension
pytest -vv -r ap --cov jupyterlab_ws_chat
```

#### Frontend tests
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"packageManager": "python",
"packageName": "jupyter_chat_extension",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall jupyter_chat_extension"
"packageName": "jupyterlab_ws_chat",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall jupyterlab_ws_chat"
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"NotebookApp": {
"nbserver_extensions": {
"jupyter_chat_extension": true
"jupyterlab_ws_chat": true
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ServerApp": {
"jpserver_extensions": {
"jupyter_chat_extension": true
"jupyterlab_ws_chat": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
# in editable mode with pip. It is highly recommended to install
# the package from a stable release or in editable mode: https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
import warnings
warnings.warn("Importing 'jupyter_chat_extension' outside a proper installation.")
warnings.warn("Importing 'jupyterlab_ws_chat' outside a proper installation.")
__version__ = "dev"

from .extension import ChatExtension

def _jupyter_labextension_paths():
return [{"src": "labextension", "dest": "jupyter-chat-extension"}]
return [{"src": "labextension", "dest": "jupyterlab-ws-chat"}]


def _jupyter_server_extension_points():
return [{"module": "jupyter_chat_extension", "app": ChatExtension}]
return [{"module": "jupyterlab_ws_chat", "app": ChatExtension}]
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
# default path to config
DEFAULT_CONFIG_PATH = os.path.join(
jupyter_data_dir(),
"jupyter_chat_extension",
"jupyterlab_ws_chat",
"config.json"
)

# default path to config JSON Schema
DEFAULT_SCHEMA_PATH = os.path.join(
jupyter_data_dir(), "jupyter_chat_extension", "config_schema.json"
jupyter_data_dir(), "jupyterlab_ws_chat", "config_schema.json"
)

# default no. of spaces to use when formatting config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "jupyter-chat-extension",
"name": "jupyterlab-ws-chat",
"version": "0.1.0",
"description": "A chat extension for Jupyterlab",
"keywords": [
Expand Down Expand Up @@ -102,12 +102,12 @@
"pip"
],
"base": {
"name": "jupyter_chat_extension"
"name": "jupyterlab_ws_chat"
}
}
},
"extension": true,
"outputDir": "jupyter_chat_extension/labextension",
"outputDir": "jupyterlab_ws_chat/labextension",
"schemaDir": "schema"
},
"eslintIgnore": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires = ["hatchling>=1.5.0", "jupyterlab>=4.0.0,<5", "hatch-nodejs-version>=0
build-backend = "hatchling.build"

[project]
name = "jupyter_chat_extension"
name = "jupyterlab_ws_chat"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.8"
Expand Down Expand Up @@ -50,26 +50,26 @@ source = "nodejs"
fields = ["description", "authors", "urls"]

[tool.hatch.build.targets.sdist]
artifacts = ["jupyter_chat_extension/labextension"]
artifacts = ["jupyterlab_ws_chat/labextension"]
exclude = [".github", "binder"]

[tool.hatch.build.targets.wheel.shared-data]
"jupyter_chat_extension/labextension" = "share/jupyter/labextensions/jupyter-chat-extension"
"install.json" = "share/jupyter/labextensions/jupyter-chat-extension/install.json"
"jupyterlab_ws_chat/labextension" = "share/jupyter/labextensions/jupyterlab-ws-chat"
"install.json" = "share/jupyter/labextensions/jupyterlab-ws-chat/install.json"
"jupyter-config/server-config" = "etc/jupyter/jupyter_server_config.d"
"jupyter-config/nb-config" = "etc/jupyter/jupyter_notebook_config.d"

[tool.hatch.build.hooks.version]
path = "jupyter_chat_extension/_version.py"
path = "jupyterlab_ws_chat/_version.py"

[tool.hatch.build.hooks.jupyter-builder]
dependencies = ["hatch-jupyter-builder>=0.5"]
build-function = "hatch_jupyter_builder.npm_builder"
ensured-targets = [
"jupyter_chat_extension/labextension/static/style.js",
"jupyter_chat_extension/labextension/package.json",
"jupyterlab_ws_chat/labextension/static/style.js",
"jupyterlab_ws_chat/labextension/package.json",
]
skip-if-exists = ["jupyter_chat_extension/labextension/static/style.js"]
skip-if-exists = ["jupyterlab_ws_chat/labextension/static/style.js"]

[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
build_cmd = "build:prod"
Expand All @@ -79,7 +79,7 @@ npm = ["jlpm"]
build_cmd = "install:extension"
npm = ["jlpm"]
source_dir = "src"
build_dir = "jupyter_chat_extension/labextension"
build_dir = "jupyterlab_ws_chat/labextension"

[tool.jupyter-releaser.hooks]
before-build-npm = [
Expand Down
14 changes: 14 additions & 0 deletions packages/jupyterlab-ws-chat/schema/chat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"title": "Jupyter chat configuration",
"description": "Configuration for the chat panel",
"type": "object",
"properties": {
"sendWithShiftEnter": {
"description": "Whether to send a message via Shift-Enter instead of Enter.",
"type": "boolean",
"default": false,
"readOnly": false
}
},
"additionalProperties": false
}
File renamed without changes
File renamed without changes.
Loading

0 comments on commit 6ae629b

Please sign in to comment.