Skip to main content

XCoding Plugin Python package for plugin development and management

Project description

test-plugin1插件

这是一个基于示例插件创建的test-plugin1插件。

功能描述

该插件接收用户配置的各种类型参数,并根据配置生成结构化的输出:

  • 文本字段: 单行文本输入
  • 数字字段: 数值输入,支持范围验证
  • 布尔字段: 是/否选择
  • 选择字段: 下拉选择框
  • 多行文本字段: 多行文本输入
  • 数组字段: 支持多个值的数组
  • 对象字段: 键值对配置
  • JSON字段: 复杂的JSON结构配置

配置参数

参数名 类型 必填 默认值 说明
text_field text "Hello from Python Plugin!" 文本输入内容
number_field number 5 数字值,范围1-100
boolean_field boolean true 布尔值选择
select_field select "option2" 下拉选择:选项1/选项2/选项3
textarea_field textarea 多行默认内容 多行文本输入
array_field array ["item1", "item2", "item3"] 数组配置
object_field object {"key1": "value1", "key2": "value2"} 对象配置
json_field json {"name": "test", "value": 123, "enabled": true} JSON配置

文件结构

example-python-plugin/
├── plugin.yaml          # 插件配置文件,定义UI表单
├── main.py              # 主执行脚本,处理配置和生成输出
├── requirements.txt     # Python依赖文件
└── README.md           # 插件说明文档

使用方法

  1. 将插件打包为ZIP文件
  2. 通过XCoding平台的插件管理页面上传
  3. 在流水线中配置并使用该插件

输出示例

插件执行后会生成包含所有配置字段的结构化输出:

=== Python示例插件输出 ===

[文本字段]
文本内容: Hello from Python Plugin!

[数字字段]
数字值: 5
数字乘以2: 10

[布尔字段]
布尔值: True
布尔值取反: False

[选择字段]
选择的选项: option2

[多行文本字段]
多行文本内容:
  这是默认的多行文本内容
  第二行内容
  第三行内容

[数组字段]
数组内容: ['item1', 'item2', 'item3']
数组元素:
  1. item1
  2. item2
  3. item3

[对象字段]
对象内容: {'key1': 'value1', 'key2': 'value2'}
对象键值对:
  key1: value1
  key2: value2

[JSON字段]
JSON内容: {'name': 'test', 'value': 123, 'enabled': True}
格式化的JSON:
{
  "name": "test",
  "value": 123,
  "enabled": true
}

开发说明

这个插件展示了如何处理所有动态表单类型的Python插件开发:

  1. 配置定义: 在plugin.yaml中定义各种类型的表单字段
  2. 配置读取: 从环境变量读取用户配置,处理各种数据类型
  3. 业务逻辑: 根据配置处理数据,展示不同类型字段的处理方式
  4. 结果输出: 生成结构化的输出格式,展示所有配置字段
  5. 错误处理: 捕获异常并返回适当的退出码

动态表单类型支持

插件支持以下表单字段类型:

  • text: 单行文本输入
  • number: 数字输入,支持验证规则
  • boolean: 布尔值选择
  • select: 下拉选择,支持自定义选项
  • textarea: 多行文本输入
  • array: 数组类型,支持添加/删除多个值
  • object: 对象类型,支持键值对配置
  • json: JSON类型,支持复杂的JSON结构

开发者可以基于这个示例创建支持各种动态表单类型的Python插件,为用户提供丰富的配置选项。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xcoding_plugin-0.1.3.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xcoding_plugin-0.1.3-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file xcoding_plugin-0.1.3.tar.gz.

File metadata

  • Download URL: xcoding_plugin-0.1.3.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for xcoding_plugin-0.1.3.tar.gz
Algorithm Hash digest
SHA256 da4b7ba8ce4baaf697a941d3cdd572dcb064b7cc27fe04cf5fd4d25839ef27ea
MD5 8ca573f8c5b16d8c1fdb340ed5be91ad
BLAKE2b-256 aaba96162a85642adb637ae34515f7d1ed5c07472c4ca046d33a4ce822fd5aa5

See more details on using hashes here.

File details

Details for the file xcoding_plugin-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for xcoding_plugin-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bf89adcd929a634414e3ff8d9daec019e81e4158f706e6791bf061d247007e8c
MD5 91ae3e4d8d6766251899886d499172de
BLAKE2b-256 5819a076cc35a3b10eec3ea41f5fd1b6d15fb2de357240eed27cfde8984796cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page