Skip to content

Commit 044058a

Browse files
committed
remove toolkit
1 parent ccdf562 commit 044058a

File tree

5 files changed

+22
-107
lines changed

5 files changed

+22
-107
lines changed

README.md

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ for the frontend extension.
1010

1111
## Features
1212

13-
- **Document Management**: Open documents in JupyterLab with various layout modes
14-
- **Markdown Preview**: Open markdown files in rendered preview mode
15-
- **Notebook Operations**: Clear outputs and show diffs for notebooks
16-
- **Jupyter AI Integration**: Tools available for use with Jupyter AI
13+
- **Command Discovery**: List all available JupyterLab commands with their metadata
14+
- **Command Execution**: Execute any JupyterLab command programmatically from Python
1715

1816
## Requirements
1917

20-
- JupyterLab >= 4.0.0
21-
- jupyter-ai (for AI toolkit functionality)
18+
- JupyterLab >= 4.5.0a3
2219

2320
## Install
2421

@@ -30,47 +27,29 @@ pip install jupyterlab_commands_toolkit
3027

3128
## Usage
3229

33-
### With Jupyter AI
34-
35-
The extension provides a toolkit for Jupyter AI with the following tools:
36-
37-
1. **open_document_tool**: Open documents in JupyterLab with various layout modes
38-
2. **open_markdown_preview_tool**: Open markdown files in rendered preview mode
39-
3. **clear_notebook_outputs_tool**: Clear all outputs in the active notebook
40-
4. **show_notebook_diff_tool**: Show git diff for the current notebook using nbdime
30+
Use the toolkit to execute any JupyterLab command from Python:
4131

4232
```python
43-
# Access the AI toolkit
44-
from jupyterlab_commands_toolkit import ai_toolkit
33+
import asyncio
34+
from jupyterlab_commands_toolkit.tools import execute_command, list_all_commands
4535

46-
# The toolkit is automatically available to Jupyter AI when installed
47-
```
36+
# Execute a command (requires running in an async context)
37+
async def main():
38+
# List all available commands
39+
commands = await list_all_commands()
4840

49-
### Direct Usage
41+
# Toggle the file browser
42+
result = await execute_command("filebrowser:toggle-main")
5043

51-
You can also use the commands directly:
52-
53-
```python
54-
from jupyterlab_commands_toolkit.tools import (
55-
open_document,
56-
open_markdown_file_in_preview_mode,
57-
clear_all_outputs_in_notebook,
58-
show_diff_of_current_notebook
59-
)
44+
# Run notebook cells
45+
result = await execute_command("notebook:run-all-cells")
6046

61-
# Open a document
62-
open_document("notebook.ipynb", mode="split-right")
63-
64-
# Open markdown in preview
65-
open_markdown_file_in_preview_mode("README.md")
66-
67-
# Clear notebook outputs
68-
clear_all_outputs_in_notebook(True)
69-
70-
# Show notebook diff
71-
show_diff_of_current_notebook(True)
47+
# Run in JupyterLab environment
48+
asyncio.run(main())
7249
```
7350

51+
For a full list of available commands in JupyterLab, refer to the [JupyterLab Command Registry documentation](https://jupyterlab.readthedocs.io/en/latest/user/commands.html#commands-list).
52+
7453
## Uninstall
7554

7655
To remove the extension, execute:

jupyterlab_commands_toolkit/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@
1414
import pathlib
1515

1616
from jupyter_server.serverapp import ServerApp
17-
from .toolkit import toolkit
18-
19-
# Export the AI toolkit for jupyter-ai integration
20-
try:
21-
from .toolkit import toolkit as ai_toolkit
22-
except ImportError:
23-
# If jupyter-ai is not available, the AI toolkit won't be available
24-
toolkit = None
2517

2618

2719
def _jupyter_labextension_paths():

jupyterlab_commands_toolkit/toolkit.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

jupyterlab_commands_toolkit/tools.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from typing import Optional, Dict, Any
21
import asyncio
3-
import uuid
42
import time
5-
from jupyter_server.serverapp import ServerApp
3+
import uuid
4+
from typing import Any, Dict, Optional
65

6+
from jupyter_server.serverapp import ServerApp
77

88
# Store for pending command results
99
pending_requests: Dict[str, Dict[str, Any]] = {}
@@ -138,7 +138,7 @@ async def execute_command(command_id: str, args: Optional[dict] = None) -> dict:
138138
>>> await execute_command("application:toggle-left-area")
139139
{'success': True, 'result': None}
140140
141-
>>> await execute_command("filebrowser:open-path", {"path": "/home/user"})
141+
>>> await execute_command("docmanager:open", {"path": "notebook.ipynb"})
142142
{'success': True, 'result': 'opened'}
143143
"""
144144
if args is None:

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ classifiers = [
2525
dependencies = [
2626
"jupyter_server>=2.4.0,<3",
2727
"jupyterlab-eventlistener",
28-
"jupyter-ai"
2928
]
3029
dynamic = ["version", "description", "authors", "urls", "keywords"]
3130

0 commit comments

Comments
 (0)