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.2.tar.gz (12.8 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.2-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for xcoding_plugin-0.1.2.tar.gz
Algorithm Hash digest
SHA256 805c90547380c7f6d8f23dcdccf6f53b6216ca377bbd7d158485838d56fd45f0
MD5 aa8fa40b10f88c33c9b7f63c17412ff9
BLAKE2b-256 9f84dad179634553bdc465d2c8cc92d3b73689b725ca9f3cada36543d5463c0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xcoding_plugin-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c07d5d39907991fababc6565add119b0d9f9fbbec5a5c8faf065fa5209f347cf
MD5 f8f8937c5d5a562afed67e9b9830dd9e
BLAKE2b-256 cd6cb2d163afdf002ddae5d8b40e40cf166cca03d1a686423546443eefd7a9d2

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