agentic_huge_data_base / wiki
页面 Argilla · 5.2 贡献工作流·DeepWiki 中文全文译文

5.2 · 贡献工作流(Contribution Workflow)

人工复核与反馈数据 · 本章是 Argilla DeepWiki 中文译文的独立章节页,保留原始链接、源码锚点、模块标签和章节层级。

项目Argilla 章节5.2 状态全文译文 模块安装与启动、测试、发布与运维、界面与交互、接口与服务契约
源码线索
  • .github/workflows/argilla-frontend.build-push-dev-frontend-docker.yml
  • .github/workflows/argilla-frontend.deploy-environment.yml
  • .github/workflows/argilla-frontend.yml
  • .github/workflows/argilla-server.yml
  • .github/workflows/argilla-v1.yml
  • .github/workflows/argilla.docs.yml
  • .github/workflows/argilla.yml
  • .github/workflows/close-inactive-issues-bot.yml
  • docs/_source/.readthedocs.yaml
  • docs/_source/_common/tabs/argilla_install_python.md
模块标签
  • 安装与启动
  • 测试、发布与运维
  • 界面与交互
  • 接口与服务契约
  • 工作流与编排

中文译文

贡献工作流(中文译文)

原始 DeepWiki 页面:https://deepwiki.com/argilla-io/argilla/5.2-contribution-workflow
翻译时间:2026-05-27T08:44:29.043Z
翻译模型:deepseek-chat
原文字符数:13056
项目:Argilla (argilla)

---

贡献工作流

相关源文件

以下文件被用作生成此 Wiki 页面的上下文:

  • .github/workflows/argilla-frontend.build-push-dev-frontend-docker.yml
  • .github/workflows/argilla-frontend.deploy-environment.yml
  • .github/workflows/argilla-frontend.yml
  • .github/workflows/argilla-server.yml
  • .github/workflows/argilla-v1.yml
  • .github/workflows/argilla.docs.yml
  • .github/workflows/argilla.yml
  • .github/workflows/close-inactive-issues-bot.yml
  • docs/_source/.readthedocs.yaml
  • docs/_source/_common/tabs/argilla_install_python.md
  • docs/_source/_static/images/og-doc.png
  • docs/_source/_templates/page.html
  • docs/_source/community/contributing.md
  • docs/_source/community/developer_docs.md
  • docs/_source/community/migration-rubrix.md
  • docs/_source/conf.py
  • docs/_source/getting_started/installation/deployments/docker.md
  • docs/_source/getting_started/installation/deployments/docker_compose.md
  • docs/_source/getting_started/installation/deployments/python.md
  • docs/_source/getting_started/quickstart.md
  • docs/_source/reference/cli.md
  • docs/_source/reference/notebooks.rst
  • docs/_source/reference/python/python_client.rst
  • docs/_source/reference/python/python_training.rst
  • docs/_source/requirements.txt
  • docs/migration-rubrix.md
  • docs/template.ipynb

本文档详细介绍了向 Argilla 项目贡献代码的流程,涵盖从搭建开发环境到将代码合并到主仓库的整个过程。有关配置开发环境的详细说明,请参阅开发环境搭建

前置条件

在向 Argilla 贡献代码之前,请确保您已完成以下操作:

  1. 了解仓库结构
  2. - argilla/:Python SDK - argilla-server/:FastAPI 服务器 - argilla-frontend/:Vue.js 用户界面 - docs/:文档

  1. 加入社区:通过 Discord 与团队和其他贡献者联系。
  1. 搭建环境:按照开发环境搭建中的说明配置您的开发环境。

来源:

  • docs/_source/community/contributing.md
  • docs/_source/community/developer_docs.md

贡献流程概览

下图展示了贡献工作流的高层概览:

graph TD
    A["Fork 仓库"] --> B["git clone https://github.com/[username]/argilla.git"]
    B --> C["git remote add upstream https://github.com/argilla-io/argilla.git"]
    C --> D["git checkout -b feature/new-feature"]
    D --> E["进行代码修改"]
    E --> F["pytest tests"]
    F --> G["git push origin feature/new-feature"]
    G --> H["在 GitHub 上创建拉取请求"]
    H --> I["GitHub Actions CI (.github/workflows/*.yml)"]
    I --> J["代码评审流程"]
    J --> K["处理评审意见"]
    K --> L["PR 合并到 develop/main"]

来源:

  • docs/_source/community/contributing.md

第一步:Fork 和克隆

  1. Fork 仓库:访问 Argilla GitHub 仓库并点击 "Fork" 按钮。
  1. 克隆您的 Fork
   git clone https://github.com/[您的 GitHub 用户名]/argilla.git
   cd argilla
  1. 添加上游远程仓库
   git remote add upstream https://github.com/argilla-io/argilla.git

来源:

  • docs/_source/community/contributing.md:80-87

第二步:创建分支

为每个要解决的问题创建一个新分支,并使用适当的前缀:

# 对于代码修改,使用 develop 作为基础分支
git checkout develop
git pull upstream develop
git checkout -b feature/您的功能名称

# 对于文档修改,使用 main 作为基础分支
git checkout main
git pull upstream main
git checkout -b docs/您的文档修改
注意:仅文档修改使用 main 分支。所有其他修改请使用 develop 分支。

来源:

  • docs/_source/community/contributing.md:94-110

第三步:进行修改

  1. 实现您的修改:进行必要的代码修改。
  2. 遵循编码规范:运行 pre-commit 以确保代码格式正确。
  3. 添加测试:为您的修改添加单元测试/集成测试。
  4. 更新 CHANGELOG.md:在相应部分下添加条目:
- 修复了 `init` 方法的键错误([#123](链接到 PR))。由 @github_handle 贡献。

来源:

  • docs/_source/community/contributing.md:117-134

第四步:测试

在提交之前,请确保所有测试通过:

对于 Python SDK:

pytest tests/unit
pytest tests/integration

对于服务器:

cd argilla-server
pdm test test/unit

对于前端:

cd argilla-frontend
npm run test

来源:

  • docs/_source/community/developer_docs.md:362-399

第五步:提交拉取请求

  1. 推送您的分支
   git push origin 您的分支名称
  1. 创建拉取请求:访问 GitHub,针对适当的基础分支(代码修改使用 develop,文档修改使用 main)创建 PR。
  1. 填写 PR 模板:添加描述性标题并使用适当的前缀(feat:bug:docs:),关联相关问题,并描述您的修改。
  1. 添加标签:为您的 PR 添加相关标签(例如 featurebugdocumentation)。

来源:

  • docs/_source/community/contributing.md:166-195

持续集成与持续交付管线

当您提交 PR 时,GitHub Actions 会自动运行多个 CI/CD 工作流:

graph TD
    PR["拉取请求"] --> CI["GitHub Actions CI"]

    CI --> SDK[".github/workflows/argilla.yml"]
    CI --> Server[".github/workflows/argilla-server.yml"]
    CI --> Frontend[".github/workflows/argilla-frontend.yml"]
    CI --> Docs[".github/workflows/argilla.docs.yml"]

    SDK --> SDK_Tests["pdm run test tests/unit"]
    SDK_Tests --> SDK_Build["pdm build"]

    Server --> Server_Tests["ARGILLA_DATABASE_URL=postgresql:// pdm test tests/unit"]
    Server_Tests --> Server_Build["pdm build"]
    Server_Build --> Docker["docker build"]

    Frontend --> Frontend_Tests["npm run test"]
    Frontend_Tests --> Frontend_Build["npm run build"]

    Docs --> Docs_Build["pdm run mike deploy"]

    SDK_Build --> Checks["所有检查通过?"]
    Docker --> Checks
    Frontend_Build --> Checks
    Docs_Build --> Checks

    Checks -- "是" --> Review["PR 评审"]
    Checks -- "否" --> Fix["修复问题"]

    Review -- "已批准" --> Merge["PR 合并"]
    Review -- "请求修改" --> Fix

    Fix --> PR

    Merge --> Release["如果是 main 分支:pdm publish 到 PyPI"]

CI/CD 管线根据受影响的组件运行不同的工作流:

  1. SDK 管线.github/workflows/argilla.yml):
  2. - 当 argilla/ 中的文件发生更改时触发 - 使用多个 Python 版本(3.9-3.13)测试 SDK - 构建 SDK 包 - 如果在 main 分支上,则发布到 PyPI

  1. 服务器管线.github/workflows/argilla-server.yml):
  2. - 当 argilla-server/ 中的文件发生更改时触发 - 设置测试服务(Elasticsearch、PostgreSQL、Redis) - 构建服务器包和 Docker 镜像 - 如果在 main 分支上,则发布到 PyPI 和 Docker Hub

  1. 前端管线.github/workflows/argilla-frontend.yml):
  2. - 当 argilla-frontend/ 中的文件发生更改时触发 - 运行 linting 和测试 - 构建前端资源

  1. 文档管线.github/workflows/argilla.docs.yml):
  2. - 当文档文件发生更改或打标签时触发 - 构建并部署文档到相应版本

来源:

  • .github/workflows/argilla.yml
  • .github/workflows/argilla-server.yml
  • .github/workflows/argilla-frontend.yml
  • .github/workflows/argilla.docs.yml

评审流程

CI 检查通过后,维护者将评审您的 PR。他们可能会:

  1. 请求修改:要求对您的代码进行修改。
  2. 批准:按原样批准您的 PR。
  3. 评论:提供一般性反馈,但不明确批准或拒绝。

处理评审意见的步骤:

  1. 在您的分支上进行请求的修改。
  2. 将修改推送到您的 Fork。
  3. 回复评审意见,说明您已进行的修改。

一旦 PR 获得批准且所有检查通过,维护者将合并您的 PR,通常使用 squash 和 merge 策略以保持提交历史的整洁。

来源:

  • docs/_source/community/contributing.md:193-204

开发环境搭建

下图说明了搭建开发环境的过程:

graph TD
    Clone["git clone https://github.com/[username]/argilla.git"] --> Install["安装依赖"]

    Install --> SDK["pip install -e ."]
    Install --> Server["pip install -e .[server,listeners,postgresql]"]
    Install --> PreCommit["pre-commit install"]
    Install --> Frontend["cd argilla-frontend && npm install"]

    PreCommit --> DB["设置数据库"]
    SDK --> DB
    Server --> DB

    DB --> ES["docker run elasticsearch-for-argilla"]
    DB --> Redis["docker run redis"]
    DB --> Postgres["docker run postgres(可选)"]

    ES --> Migrate["argilla server database migrate"]
    Redis --> Migrate
    Postgres --> Migrate

    Migrate --> User["argilla server database users create_default"]

    User --> RunServer["argilla server start"]
    User --> RunFrontend["cd argilla-frontend && npm run dev"]

    RunServer --> Test["运行测试(pytest/pdm test)"]
    RunFrontend --> Test

    Test --> Ready["准备就绪,可以开始开发"]
关键搭建步骤:
  1. 安装依赖
   # 对于 Python SDK
   cd argilla
   pip install -e .

   # 对于包含所有扩展的服务器
   pip install -e ".[server,listeners,postgresql,integrations,tests]"

   # 对于代码格式化
   pip install pre-commit
   pre-commit install

   # 对于前端
   cd argilla-frontend
   npm install
  1. 设置数据库
  2. - Elasticsearch:用于向量存储(必需) - Redis:用于任务队列(必需) - PostgreSQL(可选):替代 SQLite 用于关系数据

  1. 运行数据库迁移
   argilla server database migrate
   argilla server database users create_default
  1. 启动服务
   # 启动服务器
   argilla server start

   # 启动前端(在另一个终端中)
   cd argilla-frontend
   npm run dev

来源:

  • docs/_source/community/developer_docs.md:152-351

组件特定指南

组件基础分支测试命令受影响文件
SDKdeveloppytest tests/unit tests/integrationargilla/**
服务器developpdm test test/unitargilla-server/**
前端developnpm run testargilla-frontend/**
文档mainsphinx-autobuild docs/_source docs/_build/htmldocs/_source/**

来源:

  • docs/_source/community/developer_docs.md
  • docs/_source/community/contributing.md

PR 最佳实践

  1. 保持 PR 聚焦:每个 PR 只解决一个问题或功能。
  2. 包含测试:为您的修改添加或更新测试。
  3. 更新文档:保持文档与代码修改同步。
  4. 使用适当的前缀
  5. - PR:在标题中使用 feat:bug:docs: 前缀 - 分支:使用 feature/bug/docs/ 前缀

  6. 关联问题:始终在 PR 描述中引用相关问题
  7. 编写有意义的提交信息:使用清晰且描述性的提交信息
  8. 应用标签:为您的 PR 添加适当标签以便于分类

来源:

  • docs/_source/community/contributing.md
  • .github/workflows/argilla.yml
  • .github/workflows/argilla-server.yml
  • .github/workflows/argilla-frontend.yml
  • .github/workflows/argilla.docs.yml