本文档说明如何在本仓库进行开发和贡献代码。本仓库使用 Poetry 管理依赖,并通过 Makefile 提供常用的格式化、代码检查和测试命令。
- 除项目维护者外,请遵循 fork and pull request 流程进行贡献。
- 提交 PR 前请按照 Pull Request 模板填写相关内容。
- CI 会自动运行 lint 和测试,请在本地确保通过所有检查。
- 如果新增功能或修复 Bug,请同步更新相关文档,并尽可能在
tests/unit_tests或tests/integration_tests中添加测试。
本项目依赖使用 Poetry 管理。在安装 Poetry 之前,如使用 Conda,建议先创建并激活新的环境,例如:
conda create -n annaagent python=3.10
conda activate annaagent安装 Poetry 可参考其 官方文档。安装完成后,如使用 Conda 或 Pyenv 管理 Python,请执行:
poetry config virtualenvs.prefer-active-python true在仓库根目录执行以下命令安装开发所需依赖(包含 lint 与测试工具):
poetry install --with lint,test本仓库提供 Makefile 方便执行常用任务。以下命令均在仓库根目录运行。
使用 ruff 进行格式化:
make format运行静态检查和导入检查:
make lint运行单元测试:
make test运行集成测试:
make integration_tests生成覆盖率报告:
make coverage更多命令可执行 make help 查看。