joplin-plugin-jopyter 1.0.0
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.
package/README.md
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# Jopyter Notebook - Joplin Plugin
|
|
2
|
+
|
|
3
|
+
**Add runnable Python code blocks to your Joplin notes!**
|
|
4
|
+
|
|
5
|
+
Jopyter brings Jupyter notebook functionality directly into Joplin, allowing you to write, execute, and display Python code with rich output including plots, images, and formatted text right in your notes.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Execute Python code blocks** directly in Joplin notes
|
|
10
|
+
- **Rich output support** including:
|
|
11
|
+
- Text output (stdout/stderr)
|
|
12
|
+
- Images and plots (matplotlib, seaborn, etc.)
|
|
13
|
+
- HTML and Markdown rendering
|
|
14
|
+
- Error handling with full tracebacks
|
|
15
|
+
- **Multiple execution modes**:
|
|
16
|
+
- Run all Python blocks in a note
|
|
17
|
+
- Run the current block (cursor-based)
|
|
18
|
+
- Run specific blocks with custom kernels
|
|
19
|
+
- **Persistent kernels** for maintaining variable state between executions
|
|
20
|
+
- **Keyboard shortcuts** for quick execution
|
|
21
|
+
- **Context menus** and toolbar integration
|
|
22
|
+
- **Customizable settings** for Python path and kernel configuration
|
|
23
|
+
- **Automatic demo notebook** with comprehensive examples and tutorials
|
|
24
|
+
|
|
25
|
+
## Prerequisites
|
|
26
|
+
|
|
27
|
+
Before using Jopyter, ensure you have:
|
|
28
|
+
|
|
29
|
+
1. **Python 3.6+** installed on your system
|
|
30
|
+
2. **Required Python packages**:
|
|
31
|
+
```bash
|
|
32
|
+
pip install jupyter_client ipykernel
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
1. Download the latest `.jpl` file from the [releases page](https://github.com/Dubascudes/JopyterPlugin/releases)
|
|
38
|
+
2. In Joplin, go to **Tools → Options → Plugins**
|
|
39
|
+
3. Click **Install from file** and select the downloaded `.jpl` file
|
|
40
|
+
4. Restart Joplin
|
|
41
|
+
5. **Demo notebook**: A "Jopyter Notebook" folder will be automatically created at the top level with a comprehensive demo note containing examples and tutorials
|
|
42
|
+
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
After installation, configure Jopyter:
|
|
46
|
+
|
|
47
|
+
1. Go to **Tools → Options → Plugins → Jopyter**
|
|
48
|
+
2. Set the following options:
|
|
49
|
+
- **Python executable**: Path to your Python interpreter (e.g., `/usr/bin/python3`)
|
|
50
|
+
- **Default kernel name**: Kernel name to use (default: `python3`)
|
|
51
|
+
- **Working directory**: Optional working directory for code execution
|
|
52
|
+
|
|
53
|
+
### Platform-Specific Python Paths
|
|
54
|
+
|
|
55
|
+
- **Linux**: `/usr/bin/python3` or `~/miniconda3/envs/myenv/bin/python`
|
|
56
|
+
- **macOS**: `/opt/homebrew/bin/python3` or `/usr/local/bin/python3`
|
|
57
|
+
- **Windows**: `C:\Users\you\miniconda3\envs\myenv\python.exe`
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
### Creating Python Code Blocks
|
|
62
|
+
|
|
63
|
+
#### Method 1: Using the Menu
|
|
64
|
+
1. Place your cursor where you want the code block
|
|
65
|
+
2. Go to **Tools → Jopyter → Insert Python code block**
|
|
66
|
+
3. Or use the keyboard shortcut: `Ctrl+Alt+P` (Windows/Linux) or `Cmd+Alt+P` (macOS)
|
|
67
|
+
|
|
68
|
+
#### Method 2: Manual Creation
|
|
69
|
+
Create a code block with the following syntax:
|
|
70
|
+
````markdown
|
|
71
|
+
```python kernel=python3
|
|
72
|
+
# Your Python code here
|
|
73
|
+
print("Hello, Jopyter!")
|
|
74
|
+
```
|
|
75
|
+
````
|
|
76
|
+
|
|
77
|
+
### Executing Code
|
|
78
|
+
|
|
79
|
+
#### Run All Python Blocks
|
|
80
|
+
- **Menu**: Tools → Jopyter → Run all Python blocks
|
|
81
|
+
- **Toolbar**: Click the Python icon in the editor toolbar
|
|
82
|
+
- **Keyboard**: Use the command palette (`Ctrl+Shift+P` / `Cmd+Shift+P`)
|
|
83
|
+
|
|
84
|
+
#### Run Current Block
|
|
85
|
+
- **Keyboard**: `Ctrl+Shift+Enter` (Windows/Linux) or `Cmd+Shift+Enter` (macOS)
|
|
86
|
+
- **Context Menu**: Right-click in a Python block → "Run current Python block"
|
|
87
|
+
- **Menu**: Tools → Jopyter → Run current Python block
|
|
88
|
+
|
|
89
|
+
### Advanced Features
|
|
90
|
+
|
|
91
|
+
#### Custom Kernels
|
|
92
|
+
Specify different kernels for different code blocks:
|
|
93
|
+
````markdown
|
|
94
|
+
```python kernel=myenv
|
|
95
|
+
import pandas as pd
|
|
96
|
+
# This uses the 'myenv' kernel
|
|
97
|
+
```
|
|
98
|
+
````
|
|
99
|
+
|
|
100
|
+
#### Working Directory
|
|
101
|
+
Set a custom working directory in the plugin settings to run code from a specific location.
|
|
102
|
+
|
|
103
|
+
#### Rich Output Examples
|
|
104
|
+
````markdown
|
|
105
|
+
```python
|
|
106
|
+
import matplotlib.pyplot as plt
|
|
107
|
+
import numpy as np
|
|
108
|
+
|
|
109
|
+
# Create a simple plot
|
|
110
|
+
x = np.linspace(0, 10, 100)
|
|
111
|
+
y = np.sin(x)
|
|
112
|
+
plt.plot(x, y)
|
|
113
|
+
plt.title('Sine Wave')
|
|
114
|
+
plt.show()
|
|
115
|
+
```
|
|
116
|
+
````
|
|
117
|
+
|
|
118
|
+
### Managing Outputs
|
|
119
|
+
|
|
120
|
+
- **Clear all outputs**: Tools → Jopyter → Clear all Jopyter outputs in note
|
|
121
|
+
- **Restart kernel**: Tools → Jopyter → Restart Python kernel
|
|
122
|
+
- **Create demo notebook**: Tools → Jopyter → Create Jopyter demo notebook (creates the tutorial notebook)
|
|
123
|
+
- **Force create demo notebook**: Tools → Jopyter → Force create Jopyter demo notebook (recreate) (deletes existing and creates fresh)
|
|
124
|
+
- **Find demo notebook location**: Tools → Jopyter → Find Jopyter demo notebook location (shows where the notebook is located)
|
|
125
|
+
- **Open demo notebook**: Tools → Jopyter → Open Jopyter demo notebook (opens the demo note)
|
|
126
|
+
|
|
127
|
+
## Screenshots
|
|
128
|
+
|
|
129
|
+
To help users understand how to use Jopyter, please take the following screenshots:
|
|
130
|
+
|
|
131
|
+
### 1. Plugin Installation
|
|
132
|
+
**File**: `screenshots/installation.png`
|
|
133
|
+
- Screenshot of Joplin's plugin installation dialog
|
|
134
|
+
- Show the "Install from file" button and file selection
|
|
135
|
+
|
|
136
|
+
### 2. Plugin Settings
|
|
137
|
+
**File**: `screenshots/settings.png`
|
|
138
|
+
- Screenshot of Tools → Options → Plugins → Jopyter
|
|
139
|
+
- Show the three configuration fields:
|
|
140
|
+
- Python executable path
|
|
141
|
+
- Default kernel name
|
|
142
|
+
- Working directory
|
|
143
|
+
|
|
144
|
+
### 3. Menu Integration
|
|
145
|
+
**File**: `screenshots/menu.png`
|
|
146
|
+
- Screenshot of the Tools → Jopyter menu
|
|
147
|
+
- Show all available commands:
|
|
148
|
+
- Insert Python code block
|
|
149
|
+
- Run all Python blocks
|
|
150
|
+
- Run current Python block
|
|
151
|
+
- Restart Python kernel
|
|
152
|
+
- Clear all Jopyter outputs in note
|
|
153
|
+
|
|
154
|
+
### 4. Toolbar Button
|
|
155
|
+
**File**: `screenshots/toolbar.png`
|
|
156
|
+
- Screenshot of the editor toolbar
|
|
157
|
+
- Highlight the Python icon button for running all blocks
|
|
158
|
+
|
|
159
|
+
### 5. Context Menu
|
|
160
|
+
**File**: `screenshots/context-menu.png`
|
|
161
|
+
- Screenshot of right-clicking in a Python code block
|
|
162
|
+
- Show the context menu options for Jopyter
|
|
163
|
+
|
|
164
|
+
### 6. Basic Code Execution
|
|
165
|
+
**File**: `screenshots/basic-execution.png`
|
|
166
|
+
- Screenshot of a simple Python code block before execution
|
|
167
|
+
- Show the code and the output after running
|
|
168
|
+
|
|
169
|
+
### 7. Rich Output Example
|
|
170
|
+
**File**: `screenshots/rich-output.png`
|
|
171
|
+
- Screenshot showing matplotlib plot output
|
|
172
|
+
- Include both the code block and the rendered plot
|
|
173
|
+
|
|
174
|
+
### 8. Error Handling
|
|
175
|
+
**File**: `screenshots/error-handling.png`
|
|
176
|
+
- Screenshot of a Python code block with an error
|
|
177
|
+
- Show the error output with traceback
|
|
178
|
+
|
|
179
|
+
### 9. Multiple Code Blocks
|
|
180
|
+
**File**: `screenshots/multiple-blocks.png`
|
|
181
|
+
- Screenshot of a note with multiple Python code blocks
|
|
182
|
+
- Show different execution states (some run, some not)
|
|
183
|
+
|
|
184
|
+
### 10. Keyboard Shortcuts
|
|
185
|
+
**File**: `screenshots/keyboard-shortcuts.png`
|
|
186
|
+
- Screenshot of Joplin's keyboard shortcuts settings
|
|
187
|
+
- Highlight the Jopyter-specific shortcuts
|
|
188
|
+
|
|
189
|
+
## Keyboard Shortcuts
|
|
190
|
+
|
|
191
|
+
| Action | Windows/Linux | macOS |
|
|
192
|
+
|--------|---------------|-------|
|
|
193
|
+
| Insert Python code block | `Ctrl+Alt+P` | `Cmd+Alt+P` |
|
|
194
|
+
| Run current Python block | `Ctrl+Shift+Enter` | `Cmd+Shift+Enter` |
|
|
195
|
+
|
|
196
|
+
## Troubleshooting
|
|
197
|
+
|
|
198
|
+
### Plugin Crashes on Startup
|
|
199
|
+
If Joplin crashes when starting with Jopyter enabled:
|
|
200
|
+
|
|
201
|
+
1. **Check Python installation**: Ensure Python 3.6+ is installed
|
|
202
|
+
2. **Install required packages**:
|
|
203
|
+
```bash
|
|
204
|
+
pip install jupyter_client ipykernel
|
|
205
|
+
```
|
|
206
|
+
3. **Verify Python path**: Check that the Python executable path in settings is correct
|
|
207
|
+
4. **Check Joplin logs**: Enable developer tools (Help → Toggle Developer Tools) to see error messages
|
|
208
|
+
|
|
209
|
+
### Code Execution Issues
|
|
210
|
+
- **Module not found**: Install required Python packages in your environment
|
|
211
|
+
- **Permission errors**: Check that the working directory is accessible
|
|
212
|
+
- **Kernel issues**: Try restarting the kernel or using a different kernel name
|
|
213
|
+
|
|
214
|
+
### Output Not Displaying
|
|
215
|
+
- **Images not showing**: Ensure matplotlib/seaborn plots use `plt.show()`
|
|
216
|
+
- **HTML not rendering**: Check that the output is valid HTML
|
|
217
|
+
- **Text formatting**: Use proper markdown syntax in your output
|
|
218
|
+
|
|
219
|
+
## Development
|
|
220
|
+
|
|
221
|
+
### Building from Source
|
|
222
|
+
|
|
223
|
+
1. Clone the repository:
|
|
224
|
+
```bash
|
|
225
|
+
git clone https://github.com/Dubascudes/JopyterPlugin.git
|
|
226
|
+
cd JopyterPlugin
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
2. Install dependencies:
|
|
230
|
+
```bash
|
|
231
|
+
npm install
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
3. Build the plugin:
|
|
235
|
+
```bash
|
|
236
|
+
npm run dist
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
4. The built plugin will be in the `publish/` directory
|
|
240
|
+
|
|
241
|
+
### Project Structure
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
src/
|
|
245
|
+
├── index.ts # Main plugin logic
|
|
246
|
+
├── editor.ts # CodeMirror editor integration
|
|
247
|
+
├── manifest.json # Plugin manifest
|
|
248
|
+
└── python/
|
|
249
|
+
└── bridge.py # Python-Jupyter bridge script
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Contributing
|
|
253
|
+
|
|
254
|
+
1. Fork the repository
|
|
255
|
+
2. Create a feature branch
|
|
256
|
+
3. Make your changes
|
|
257
|
+
4. Test thoroughly
|
|
258
|
+
5. Submit a pull request
|
|
259
|
+
|
|
260
|
+
## License
|
|
261
|
+
|
|
262
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
263
|
+
|
|
264
|
+
## Support
|
|
265
|
+
|
|
266
|
+
- **Issues**: [GitHub Issues](https://github.com/Dubascudes/JopyterPlugin/issues)
|
|
267
|
+
- **Discussions**: [GitHub Discussions](https://github.com/Dubascudes/JopyterPlugin/discussions)
|
|
268
|
+
- **Website**: [willenglish.tech](https://willenglish.tech/)
|
|
269
|
+
|
|
270
|
+
## Changelog
|
|
271
|
+
|
|
272
|
+
### v1.0.0
|
|
273
|
+
- Initial release
|
|
274
|
+
- Basic Python code execution
|
|
275
|
+
- Rich output support
|
|
276
|
+
- Multiple execution modes
|
|
277
|
+
- Keyboard shortcuts and context menus
|
|
278
|
+
- Customizable settings
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
**Made with ❤️ for the Joplin community**
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "joplin-plugin-jopyter",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"dist": "webpack --env joplin-plugin-config=buildMain && webpack --env joplin-plugin-config=buildExtraScripts && webpack --env joplin-plugin-config=createArchive",
|
|
6
|
+
"prepare": "npm run dist",
|
|
7
|
+
"updateVersion": "webpack --env joplin-plugin-config=updateVersion",
|
|
8
|
+
"update": "npm install -g generator-joplin && yo joplin --node-package-manager npm --update --force"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"joplin-plugin"
|
|
13
|
+
],
|
|
14
|
+
"files": [
|
|
15
|
+
"publish"
|
|
16
|
+
],
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^18.7.13",
|
|
19
|
+
"chalk": "^4.1.0",
|
|
20
|
+
"copy-webpack-plugin": "^11.0.0",
|
|
21
|
+
"fs-extra": "^10.1.0",
|
|
22
|
+
"glob": "^8.0.3",
|
|
23
|
+
"tar": "^6.1.11",
|
|
24
|
+
"ts-loader": "^9.3.1",
|
|
25
|
+
"typescript": "^4.8.2",
|
|
26
|
+
"webpack": "^5.74.0",
|
|
27
|
+
"webpack-cli": "^4.10.0"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 1,
|
|
3
|
+
"id": "tech.willenglish.jopyter",
|
|
4
|
+
"app_min_version": "3.3",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"name": "Jopyter Notebook",
|
|
7
|
+
"description": "Add runnable Python code blocks to your notes!",
|
|
8
|
+
"author": "William English",
|
|
9
|
+
"homepage_url": "https://willenglish.tech/",
|
|
10
|
+
"repository_url": "https://github.com/Dubascudes/JopyterPlugin",
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"categories": [],
|
|
13
|
+
"screenshots": [],
|
|
14
|
+
"icons": {},
|
|
15
|
+
"promo_tile": {},
|
|
16
|
+
"_publish_hash": "sha256:b32445784014218bbd5216046bfd1968909f76f18d26f2fe646cd03cb99ec4c5",
|
|
17
|
+
"_publish_commit": "main:718af781dfe739b099ece40e243d4898ad11a63c"
|
|
18
|
+
}
|