Skip to content

Commit 46c3097

Browse files
author
Elijah Wilson
committed
rename
1 parent 4096d8e commit 46c3097

File tree

17 files changed

+38
-36
lines changed

17 files changed

+38
-36
lines changed

.github/assets/example.png

165 KB
Loading

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ https://noteable.io/chatgpt-plugin-for-notebook/.
99

1010
This is heavily inspired by [dangermode](https://github.com/rgbkrk/dangermode).
1111
It could have been a fork, but the code is small enough that I started from scratch.
12+
13+
![example](.github/assets/example.png)

Taskfile.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
version: "3"
22

33
vars:
4-
LINT_DIRS: "notebookgpt/"
4+
LINT_DIRS: "jupychat/"
55

66
tasks:
77
serve:
88
deps:
99
- install-deps
1010
cmds:
11-
- poetry run uvicorn notebookgpt.main:app --reload --host "0.0.0.0" --port 8000
11+
- poetry run uvicorn jupychat.main:app --reload --host "0.0.0.0" --port 8000
1212

1313
install-deps:
1414
run: once

notebookgpt/app_utils.py renamed to jupychat/app_utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
from fastapi.middleware.cors import CORSMiddleware
77
from fastapi.staticfiles import StaticFiles
88

9-
from notebookgpt.auth import jwks_client
10-
from notebookgpt.kernels import get_nb_gpt_kernel_client
11-
from notebookgpt.routes import api, auth, root
12-
from notebookgpt.settings import DOMAIN, get_settings
9+
from jupychat.auth import jwks_client
10+
from jupychat.kernels import get_nb_gpt_kernel_client
11+
from jupychat.routes import api, auth, root
12+
from jupychat.settings import DOMAIN, get_settings
1313

1414
static_directory = pathlib.Path(__file__).parent / "static"
1515

notebookgpt/auth.py renamed to jupychat/auth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from jwt import PyJWKClient
55
from starlette import status
66

7-
from notebookgpt.settings import get_settings
7+
from jupychat.settings import get_settings
88

99
jwks_client = PyJWKClient(get_settings().jwks_url, cache_keys=True)
1010
bearer_scheme = HTTPBearer(auto_error=False)

notebookgpt/kernels.py renamed to jupychat/kernels.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
from kernel_sidecar.models import messages
1212
from kernel_sidecar.models.messages import CellStatus, StreamChannel
1313

14-
from notebookgpt.models import (
14+
from jupychat.models import (
1515
CreateKernelRequest,
1616
CreateKernelResponse,
1717
DisplayData,
1818
RunCellRequest,
1919
RunCellResponse,
2020
image_store,
2121
)
22-
from notebookgpt.settings import get_settings
22+
from jupychat.settings import get_settings
2323

2424
logger = structlog.get_logger(__name__)
2525

@@ -31,7 +31,7 @@ def safe_get_ipython():
3131
return InteractiveShellEmbed()
3232

3333

34-
class NotebookGPTKernelClient:
34+
class JupyChatKernelClient:
3535
"""Client class for managing jupyter kernels.
3636
3737
This wraps the jupyter multi kernel manager and provides a simple
@@ -52,7 +52,7 @@ async def start_kernel(self, request: CreateKernelRequest) -> CreateKernelRespon
5252

5353
async def run_cell(self, request: RunCellRequest) -> RunCellResponse:
5454
sidecar_client = self._sidecar_clients[request.kernel_id]
55-
output_handler = NotebookGPTOutputHandler(sidecar_client, uuid.uuid4().hex)
55+
output_handler = JupyChatOutputHandler(sidecar_client, uuid.uuid4().hex)
5656
status_handler = StatusHandler()
5757
await sidecar_client.execute_request(
5858
request.code, handlers=[output_handler, status_handler]
@@ -66,7 +66,7 @@ async def shutdown_all(self) -> None:
6666
logger.info("Shut down kernel", kernel_id=kernel_id)
6767

6868

69-
class NotebookGPTOutputHandler(OutputHandler):
69+
class JupyChatOutputHandler(OutputHandler):
7070
def __init__(self, client: KernelSidecarClient, cell_id: str):
7171
super().__init__(client, cell_id)
7272

@@ -125,7 +125,7 @@ async def handle_execute_reply(self, msg: messages.ExecuteReply) -> None:
125125

126126

127127
@lru_cache(maxsize=1)
128-
def get_nb_gpt_kernel_client() -> NotebookGPTKernelClient:
128+
def get_nb_gpt_kernel_client() -> JupyChatKernelClient:
129129
settings = get_settings()
130130
mkm = AsyncMultiKernelManager(connection_dir=settings.jupyter_connection_dir)
131-
return NotebookGPTKernelClient(mkm)
131+
return JupyChatKernelClient(mkm)

jupychat/main.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from jupychat.app_utils import build_app
2+
3+
app = build_app()

notebookgpt/models.py renamed to jupychat/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from jupyter_client.kernelspec import NATIVE_KERNEL_NAME
66
from pydantic import BaseModel, Field
77

8-
from notebookgpt.settings import DOMAIN
8+
from jupychat.settings import DOMAIN
99

1010

1111
class RunCellRequest(BaseModel):

notebookgpt/routes/api.py renamed to jupychat/routes/api.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
from fastapi import APIRouter, Depends, HTTPException, Security
22

3-
from notebookgpt.auth import verify_jwt
4-
from notebookgpt.kernels import NotebookGPTKernelClient, get_nb_gpt_kernel_client
5-
from notebookgpt.models import (
3+
from jupychat.auth import verify_jwt
4+
from jupychat.kernels import JupyChatKernelClient, get_nb_gpt_kernel_client
5+
from jupychat.models import (
66
CreateKernelRequest,
77
CreateKernelResponse,
88
RunCellRequest,
99
RunCellResponse,
1010
)
11-
from notebookgpt.suggestions import RUN_CELL_PARSE_FAIL
11+
from jupychat.suggestions import RUN_CELL_PARSE_FAIL
1212

1313
router = APIRouter(dependencies=[Security(verify_jwt)])
1414

1515

1616
@router.post("/kernels")
1717
async def create_kernel(
1818
request: CreateKernelRequest,
19-
kernel_client: NotebookGPTKernelClient = Depends(get_nb_gpt_kernel_client),
19+
kernel_client: JupyChatKernelClient = Depends(get_nb_gpt_kernel_client),
2020
) -> CreateKernelResponse:
2121
"""Create and start kernel with the given kernel name."""
2222
return await kernel_client.start_kernel(request)
@@ -25,7 +25,7 @@ async def create_kernel(
2525
@router.post("/run-cell")
2626
async def run_cell(
2727
request: RunCellRequest,
28-
kernel_client: NotebookGPTKernelClient = Depends(get_nb_gpt_kernel_client),
28+
kernel_client: JupyChatKernelClient = Depends(get_nb_gpt_kernel_client),
2929
) -> RunCellResponse:
3030
"""Execute a cell and return the result.
3131

notebookgpt/routes/auth.py renamed to jupychat/routes/auth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import httpx
44
from fastapi import APIRouter, Depends, HTTPException, Request, Response, status
55

6-
from notebookgpt.settings import Settings, get_settings
6+
from jupychat.settings import Settings, get_settings
77

88
router = APIRouter()
99

notebookgpt/routes/root.py renamed to jupychat/routes/root.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
from fastapi.templating import Jinja2Templates
77
from jinja2 import Template
88

9-
from notebookgpt.auth import get_user_is_authenticated
10-
from notebookgpt.models import image_store
11-
from notebookgpt.settings import Settings, get_settings
9+
from jupychat.auth import get_user_is_authenticated
10+
from jupychat.models import image_store
11+
from jupychat.settings import Settings, get_settings
1212

1313
router = APIRouter()
14-
templates = Jinja2Templates(directory="notebookgpt/templates")
14+
templates = Jinja2Templates(directory="jupychat/templates")
1515

1616

1717
@router.get("/.well-known/ai-plugin.json", include_in_schema=False)

notebookgpt/settings.py renamed to jupychat/settings.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from pydantic import BaseSettings
55

6-
DOMAIN = os.environ.get("NOTEBOOKGPT_DOMAIN", "http://localhost:8000")
6+
DOMAIN = os.environ.get("JUPYCHAT_DOMAIN", "http://localhost:8000")
77

88

99
class Settings(BaseSettings):
@@ -17,9 +17,9 @@ class Settings(BaseSettings):
1717
jwks_url: str = "https://chatgpt-plugin-demo.us.auth0.com/.well-known/jwks.json"
1818
jwks_cache_time_sec: int = 300
1919

20-
oauth_audience: str = "https://example.com/notebookgpt"
20+
oauth_audience: str = "https://example.com/jupychat"
2121

22-
jupyter_connection_dir: str = "/tmp/notebookgpt_connection_files"
22+
jupyter_connection_dir: str = "/tmp/jupychat_connection_files"
2323

2424

2525
@lru_cache()
File renamed without changes.
File renamed without changes.

notebookgpt/templates/ai-plugin.yaml renamed to jupychat/templates/ai-plugin.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
schema_version: v1
2-
name_for_human: NotebookGPT v2
3-
name_for_model: notebookgpt_v2
2+
name_for_human: JupyChat
3+
name_for_model: jupychat
44
logo_url: {{ LOGO_URL }}
55
contact_email: [email protected]
6-
legal_info_url: https://github.com/tizz98/notebookgpt/issues
6+
legal_info_url: https://github.com/tizz98/chatgpt-notebook-plugin/issues
77

88
api:
99
type: openapi

notebookgpt/main.py

-3
This file was deleted.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.poetry]
2-
name = "notebookgpt"
2+
name = "jupychat"
33
version = "0.1.0"
44
description = "A simple ChatGPT plugin to run jupyter notebooks"
55
authors = ["Elijah Wilson <[email protected]>"]

0 commit comments

Comments
 (0)