Files
dify-docs/plugin_dev_en/9241-bundle.en.mdx
2025-05-04 01:17:47 +08:00

122 lines
4.8 KiB
Plaintext

---
dimensions:
type:
primary: implementation
detail: advanced
level: beginner
standard_title: Bundle
language: en
title: Bundle Plugin Package
description: This document introduces the concept and development method of Bundle
plugin packages. Bundle plugin packages can aggregate multiple plugins together,
supporting three types (Marketplace, GitHub, and Package). The document details
the entire process of creating a Bundle project, adding different types of dependencies,
and packaging the Bundle project.
---
A Bundle plugin package is a collection of multiple plugins. It allows packaging several plugins within a single plugin, enabling batch installation and providing more powerful services.
You can use the Dify CLI tool to package multiple plugins into a Bundle. Bundle plugin packages come in three types:
* `Marketplace` type. Stores the plugin's ID and version information. During import, the specific plugin package will be downloaded from the Dify Marketplace.
* `GitHub` type. Stores the GitHub repository address, release version number, and asset filename. During import, Dify will access the corresponding GitHub repository to download the plugin package.
* `Package` type. The plugin package is stored directly within the Bundle. It does not store reference sources, but this might lead to a larger Bundle package size.
### Prerequisites
* Dify plugin scaffolding tool
* Python environment, version ≥ 3.10
For detailed instructions on how to prepare the plugin development scaffolding tool, please refer to [Initialize Development Tools](/plugin_dev_en/0221-initialize-development-tools.en).
### Create a Bundle Project
In the current directory, run the scaffolding command-line tool to create a new plugin package project.
```bash
./dify-plugin-darwin-arm64 bundle init
```
If you have renamed the binary file to `dify` and copied it to the `/usr/local/bin` path, you can run the following command to create a new plugin project:
```bash
dify bundle init
```
#### 1. Fill in Plugin Information
Follow the prompts to configure the plugin name, author information, and plugin description. If you are collaborating as a team, you can also enter the organization name as the author.
> The name must be 1-128 characters long and can only contain letters, numbers, hyphens, and underscores.
![Bundle basic information](https://assets-docs.dify.ai/2024/12/03a1c4cdc72213f09523eb1b40832279.png)
After filling in the information and pressing Enter, the Bundle plugin project directory will be automatically created.
![](https://assets-docs.dify.ai/2024/12/356d1a8201fac3759bf01ee64e79a52b.png)
#### 2. Add Dependencies
* **Marketplace**
Execute the following command:
```bash
dify-plugin bundle append marketplace . --marketplace_pattern=langgenius/openai:0.0.1
```
Where `marketplace_pattern` is the reference to the plugin in the marketplace, in the format `organization_name/plugin_name:version_number`.
* **Github**
Execute the following command:
```bash
dify-plugin bundle append github . --repo_pattern=langgenius/openai:0.0.1/openai.difypkg
```
Where `repo_pattern` is the reference to the plugin on GitHub, in the format `organization_name/repository_name:release/asset_name`.
* **Package**
Execute the following command:
```bash
dify-plugin bundle append package . --package_path=./openai.difypkg
```
Where `package_path` is the directory of the plugin package.
### Package the Bundle Project
Run the following command to package the Bundle plugin:
```bash
dify-plugin bundle package ./bundle
```
After executing the command, a `bundle.difybndl` file will be automatically created in the current directory. This file is the final packaged result.
{/*
Contributing Section
DO NOT edit this section!
It will be automatically generated by the script.
*/}
<CardGroup cols="2">
<Card
title="Edit this page"
icon="pen-to-square"
href="https://github.com/langgenius/dify-docs-mintlify/edit/main/plugin_dev_en/9241-bundle.en.mdx"
>
Help improve our documentation by contributing directly
</Card>
<Card
title="Report an issue"
icon="github"
href="https://github.com/langgenius/dify-docs-mintlify/issues/new?title=Documentation%20Issue%3A%20bundle&body=%23%23%20Issue%20Description%0A%3C%21--%20Please%20briefly%20describe%20the%20issue%20you%20found%20--%3E%0A%0A%23%23%20Page%20Link%0Ahttps%3A%2F%2Fgithub.com%2Flanggenius%2Fdify-docs-mintlify%2Fblob%2Fmain%2Fplugin_dev_en%2F9241-bundle.en.mdx%0A%0A%23%23%20Suggested%20Changes%0A%3C%21--%20If%20you%20have%20specific%20suggestions%20for%20changes%2C%20please%20describe%20them%20here%20--%3E%0A%0A%3C%21--%20Thank%20you%20for%20helping%20improve%20our%20documentation%21%20--%3E"
>
Found an error or have suggestions? Let us know
</Card>
</CardGroup>