@galaxyproject/jupyterlite 0.0.4 → 0.0.6

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 CHANGED
@@ -1,39 +1,47 @@
1
- # JupyterLite + Pyodide Setup
1
+ # JupyterLite + Galaxy Integration
2
2
 
3
3
  This project integrates JupyterLite with the Pyodide kernel and custom extensions such as `jl-galaxy`.
4
4
 
5
+ The `jl-galaxy` extension enables Jupyter users to interact seamlessly with their Galaxy history — including loading and saving notebooks — through a fully integrated browser-based interface.
6
+
5
7
  ## ⚙️ Requirements
6
8
 
7
- - Python 3.7+
8
- - Node.js 16+
9
- - npm 7+
9
+ - Python **3.10.17+**
10
+ - Node.js **20.19.1+**
11
+ - npm **10.8.2+**
10
12
 
11
- ## 📦 Installation
13
+ ---
12
14
 
13
- ### 1. Set up Python dependencies
15
+ ## 📦 Setup Instructions
14
16
 
15
- Install JupyterLite and the Pyodide kernel plugin:
17
+ ### 1. Create and activate a virtual environment
16
18
 
17
19
  ```bash
18
- pip install jupyterlite
19
- pip install jupyterlite-pyodide-kernel
20
+ python -m venv .venv
21
+ source .venv/bin/activate
20
22
  ```
21
23
 
22
- > These packages provide the CLI and register the Pyodide kernel for bundling.
24
+ ### 2. Install Python dependencies
25
+
26
+ ```bash
27
+ pip install -r requirements.txt
28
+ ```
23
29
 
24
- ### 2. Set up Node dependencies
30
+ This installs `jupyterlite`, `jupyterlite-pyodide-kernel`, and the `gxy` utility module for Galaxy integration.
25
31
 
26
- Install JavaScript dependencies (for building extensions):
32
+ ### 3. Install Node.js dependencies
27
33
 
28
34
  ```bash
29
35
  npm install
30
36
  ```
31
37
 
32
- This installs dependencies listed in `package.json`, such as custom JupyterLite extensions.
38
+ This installs JavaScript dependencies listed in `package.json`, including custom JupyterLite extensions.
39
+
40
+ ---
33
41
 
34
42
  ## 🔨 Build
35
43
 
36
- Run the build to generate a standalone JupyterLite distribution:
44
+ Run the full build to generate a standalone JupyterLite distribution:
37
45
 
38
46
  ```bash
39
47
  npm run build
@@ -42,29 +50,92 @@ npm run build
42
50
  This will:
43
51
  - Run `jupyter lite build`
44
52
  - Include the Pyodide kernel
45
- - Bundle your extensions (e.g., `jl-galaxy`)
46
- - Generate the final site in `./static/dist/_output`
53
+ - Bundle federated extensions like `jl-galaxy`
54
+ - Output the final static site to: `./static/dist/_output`
55
+
56
+ ---
47
57
 
48
- ## 🚀 Launch
58
+ ## 🚀 Serve
49
59
 
50
- You can serve the output using any static file server. For quick testing:
60
+ To serve the JupyterLite site locally:
51
61
 
52
62
  ```bash
53
- npx serve static/dist/_output
63
+ npm run serve
54
64
  ```
55
65
 
56
- Or use Python:
66
+ Then open [http://localhost:3000](http://localhost:3000) in your browser.
57
67
 
58
- ```bash
59
- cd static/dist/_output
60
- python -m http.server
68
+ ---
69
+
70
+ ## 🧰 Galaxy Integration Utilities (`gxy`)
71
+
72
+ The `gxy` module provides Python functions to interact with the Galaxy API directly from JupyterLite.
73
+
74
+ ### ✅ `api(endpoint, method="GET", data=None)`
75
+ Makes an HTTP request to a Galaxy API endpoint and returns the parsed JSON response.
76
+
77
+ ```python
78
+ await api("/api/histories")
79
+ await api("/api/histories", method="POST", data={"name": "New History"})
61
80
  ```
62
81
 
63
- Then open [http://localhost:8000](http://localhost:8000) in your browser.
82
+ ---
83
+
84
+ ### ✅ `get(datasets_identifiers, identifier_type="hid", retrieve_datatype=False)`
85
+ Downloads dataset(s) by HID, ID, or regex pattern. Saves them to Pyodide's virtual filesystem.
86
+
87
+ ```python
88
+ await get(3) # by HID
89
+ await get("some_id", identifier_type="id")
90
+ await get("myfile.*", identifier_type="regex")
91
+ ```
64
92
 
65
93
  ---
66
94
 
67
- ## 💡 Notes
95
+ ### `put(name, output=None, ext="auto", dbkey="?", history_id=None)`
96
+ Uploads a file from the virtual filesystem to the current Galaxy history.
97
+
98
+ ```python
99
+ await put("mydata.txt", "newname.txt", ext="txt")
100
+ ```
101
+
102
+ ---
103
+
104
+ ### ✅ `get_history(history_id=None)`
105
+ Returns metadata for all visible datasets in the current history.
106
+
107
+ ```python
108
+ await get_history()
109
+ ```
110
+
111
+ ---
112
+
113
+ ### ✅ `get_history_id()`
114
+ Returns the current history ID based on the dataset context.
115
+
116
+ ```python
117
+ await get_history_id()
118
+ ```
119
+
120
+ ---
121
+
122
+ ### ✅ `get_environment()`
123
+ Returns the Galaxy environment injected into the session via `__gxy__`.
124
+
125
+ ```python
126
+ get_environment()
127
+ ```
128
+
129
+ ---
130
+
131
+ ### ✅ `_find_matching_ids(history_datasets, list_of_regex_patterns, identifier_type='hid')`
132
+ Used internally to resolve regex patterns to dataset identifiers.
133
+
134
+ ---
135
+
136
+ ## 📎 Notes
137
+
138
+ - The `jl-galaxy` extension allows users to browse and manage Galaxy histories directly from the Jupyter UI.
139
+ - All files must be placed within `static/dist/_output`; writing outside this directory breaks the build.
140
+ - The upload helper uses `XMLHttpRequest` to work around Pyodide's limitations with `fetch`.
68
141
 
69
- - The build process automatically configures the Pyodide kernel and registers it as a federated extension.
70
- - If you're developing additional extensions, make sure to register them in `jupyter-lite.json` under `federated_extensions`.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@galaxyproject/jupyterlite",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "static/dist"
7
7
  ],
8
8
  "scripts": {
9
- "build": "webpack && npm run build:jupyter && npm run build:gxy && npm run build:extension && npm run build:patch && npm run build:index",
9
+ "build": "webpack && npm run build:jupyter && npm run build:extension && npm run build:gxy && npm run build:patch && npm run build:index",
10
10
  "build:extension": "node install-extension.js",
11
11
  "build:gxy": "cd gxy && python -m build --wheel",
12
12
  "build:index": "cpx src/index.js static/dist",
@@ -23,5 +23,8 @@
23
23
  "typescript": "^5.4.2",
24
24
  "webpack": "^5.89.0",
25
25
  "webpack-cli": "^5.1.4"
26
+ },
27
+ "dependencies": {
28
+ "node-fetch": "^3.3.2"
26
29
  }
27
30
  }
@@ -306,7 +306,22 @@
306
306
  "@jupyterlite/pyodide-kernel-extension:kernel": {
307
307
  "loadPyodideOptions": {
308
308
  "packages": [
309
- "../../../../pypi/gxy-0.0.0-py3-none-any.whl"
309
+ "../../../../pypi/gxy-0.0.0-py3-none-any.whl",
310
+ "../../../../pypi/attrs-25.3.0-py3-none-any.whl",
311
+ "../../../../pypi/fastjsonschema-2.21.1-py3-none-any.whl",
312
+ "../../../../pypi/gxy-0.0.0-py3-none-any.whl",
313
+ "../../../../pypi/jsonschema-4.23.0-py3-none-any.whl",
314
+ "../../../../pypi/jsonschema_specifications-2025.4.1-py3-none-any.whl",
315
+ "../../../../pypi/jupyter_core-5.7.2-py3-none-any.whl",
316
+ "../../../../pypi/narwhals-1.38.2-py3-none-any.whl",
317
+ "../../../../pypi/nbformat-5.10.4-py3-none-any.whl",
318
+ "../../../../pypi/packaging-25.0-py3-none-any.whl",
319
+ "../../../../pypi/platformdirs-4.3.8-py3-none-any.whl",
320
+ "../../../../pypi/plotly-6.0.1-py3-none-any.whl",
321
+ "../../../../pypi/referencing-0.36.2-py3-none-any.whl",
322
+ "../../../../pypi/traitlets-5.14.3-py3-none-any.whl",
323
+ "../../../../pypi/typing_extensions-4.13.2-py3-none-any.whl",
324
+ "rpds-py"
310
325
  ]
311
326
  }
312
327
  }