# @galaxyproject/jupyterlite 中文文档

规范地址：https://npmcn.com/package/%40galaxyproject/jupyterlite/

版本：0\.0\.32
npm 元数据更新时间：2026-09-23T22:03:16.904Z
中文译文更新时间：2026-11-15T21:34:40.195Z
软件包许可：未声明

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40galaxyproject/jupyterlite
原文对照：https://npmcn.com/package/%40galaxyproject/jupyterlite/?lang=original

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：84.9 MB，907 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- 运行依赖：0 个
- 首次发布：2025-05-07T00:03:09.154Z
- 最新版本发布：2026-09-23T22:03:16.721Z
- 近 30 天下载量：11949（2026-10-16 至 2026-11-14，npm 官方下载统计）
- 已发布版本数：32（近 12 个月 15 个）

## 中文简介

这个项目将 JupyterLite 与 Pyodide 内核和自定义扩展集成在一起, 例如 `jl-galaxy`。 。 。 .

## 安装

```sh
npm install @galaxyproject/jupyterlite
```

也可以使用：`pnpm add @galaxyproject/jupyterlite`、`yarn add @galaxyproject/jupyterlite`、`bun add @galaxyproject/jupyterlite`

## README

# JupyterLite + 银河一体化

这个项目将 JupyterLite 与 Pyodide 内核和自定义扩展集成在一起, 例如 `jl-galaxy`。 。 。 .

这个 `jl-galaxy` 扩展让Jupyter用户能够通过一个完全集成的基于浏览器的界面,与他们的Galaxy历史无缝地互动——包括加载和保存笔记本.

## 所需经费

-   蟒 **3.10.17+ (中文(简体) )**
-   节点.js **20.19.1+ (中文(简体) )**
-   无 **10.8.2+ (单位:千美元)**

* * *

## QQ 设置指令

### 1\. 创建和激活虚拟环境

```bash
python -m venv .venv
source .venv/bin/activate
```

### 2\. 安装 Python 依赖性

```bash
pip install -r requirements.txt
```

此安装 `jupyterlite`, (中文(简体) ), `jupyterlite-pyodide-kernel`,则 `gxy` 银河系统一体化实用模块.

### 3\. 安装节点js依赖性

```bash
npm install
```

安装 JavaScript 依赖性 `package.json`,包括自定义的JupyterLite扩展.

* * *

## QQ 构建

运行完整的构建以生成独立的 JupyterLite 分布 :

```bash
npm run build
```

这将:

-   运行 `jupyter lite build`
-   包含 Pyodide 内核
-   捆绑式联邦扩展像 `jl-galaxy`
-   输出最后的静态站点到 : `./static/dist/_output`

* * *

## 服务

在当地服务JupyterLite网站:

```bash
npm run serve
```

然后打开 [http://localhost:3:00 (英语)](http://localhost:3000/) 在您的浏览器中.

* * *

## 银河一体化公用事业`gxy`(中文(简体) )

这个 `gxy` 模块提供Python函数,直接从JupyterLite与Galaxy API交互.

### ✅ `api(endpoint, method="GET", data=None)`

向 Galaxy API 端点提交 HTTP 请求并返回解析后的 JSON 响应 .

```python
await api("/api/histories")
await api("/api/histories", method="POST", data={"name": "New History"})
```

* * *

### ✅ `get(datasets_identifiers, identifier_type="hid", retrieve_datatype=False)`

通过HID,ID,或regex模式来下载数据集. 将其保存到Pyodide的虚拟文件系统.

```python
await get(3)                          # by HID
await get("some_id", "id")
await get("myfile.*", "regex")
await get("mytag", "tag")
```

* * *

### ✅ `put(name, output=None, ext="auto", dbkey="?", history_id=None)`

将一个文件从虚拟文件系统上传到当前的Galaxy历史.

```python
await put("mydata.txt", "newname.txt", ext="txt")
```

* * *

### ✅ `get_history(history_id=None)`

返回当前历史中所有可见数据集的元数据.

```python
await get_history()
```

* * *

### ✅ `get_history_id()`

根据数据集上下文返回当前历史 ID.

```python
await get_history_id()
```

* * *

### ✅ `get_environment()`

通过 `__gxy__`。 。 。 .

```python
get_environment()
```

* * *

### ✅ `_find_matching_ids(history_datasets, list_of_regex_patterns, identifier_type='hid')`

内部用于解析regex模式到数据集标识符.

* * *

## 页:1

-   这个 `jl-galaxy` 扩展允许用户直接从Jupyter UI浏览和管理Galaxy历史.
-   所有文件必须放在里面 `static/dist/_output`; 在此目录外写入会打破构建.
-   上传助手使用 `XMLHttpRequest` 绕着Pyodide的局限性工作 `fetch`。 。 。 .

## 常见问题

### @galaxyproject/jupyterlite 是什么？

这个项目将 JupyterLite 与 Pyodide 内核和自定义扩展集成在一起, 例如 jl-galaxy。 。 。 \.

### 如何安装 @galaxyproject/jupyterlite？

在项目目录运行 npm install @galaxyproject/jupyterlite，或使用 pnpm add / yarn add / bun add。

### @galaxyproject/jupyterlite 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/galaxyproject\_\_jupyterlite 是否存在。

### @galaxyproject/jupyterlite 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @galaxyproject/jupyterlite 可以商用吗？

@galaxyproject/jupyterlite 使用 未声明 许可。package\.json 没有声明许可证。没有许可证的代码默认保留全部权利，商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括，不构成法律意见，请以许可原文为准。

### @galaxyproject/jupyterlite 的下载量有多少？

根据 npm 官方下载统计，@galaxyproject/jupyterlite 在 2026/10/16 – 2026/11/14 这 30 天内被下载 11,949 次，日均约 398 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @galaxyproject/jupyterlite 还在维护吗？

最新版本 0\.0\.32 发布于 2026/09/24（1 个月前）；至今共发布 32 个版本，其中过去 12 个月发布了 15 个；首次发布于 2025/05/07。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

