Skip to content

chore: tighten package hygiene and packaging smoke coverage#377

Merged
liujuanjuan1984 merged 2 commits intomainfrom
chore/367-a2a-python-best-practices-review
Apr 2, 2026
Merged

chore: tighten package hygiene and packaging smoke coverage#377
liujuanjuan1984 merged 2 commits intomainfrom
chore/367-a2a-python-best-practices-review

Conversation

@liujuanjuan1984
Copy link
Copy Markdown
Collaborator

背景

Package Metadata

  • 删除未直接使用的运行时依赖 requests,并同步刷新 uv.lock
  • 添加 src/opencode_a2a/py.typed
  • pyproject.toml 中声明 package data,显式发布 typed package 信号

Logging Baseline

  • src/opencode_a2a/__init__.py 为 package logger 安装 NullHandler
  • 新增 tests/package/test_logging.py 覆盖该基线

Packaging Smoke Test

  • 增强 scripts/smoke_test_built_cli.sh,在 /health 检查前先验证安装后的工具环境可以导入 opencode_a2a
  • 兼容 uv tool install 生成 bin/python 软链接的场景,避免 smoke test 误判

Tests And Validation

  • 新增 tests/package/test_typing_contract.py
  • 扩展 tests/scripts/test_script_health_contract.py
  • 执行 bash -n scripts/smoke_test_built_cli.sh
  • 执行 rm -rf build dist && uv build --no-sources
  • 执行 bash ./scripts/smoke_test_built_cli.sh dist/opencode_a2a-*.whl
  • 执行 bash ./scripts/smoke_test_built_cli.sh dist/opencode_a2a-*.tar.gz
  • 执行 ./scripts/doctor.sh

Issue 关联

@liujuanjuan1984
Copy link
Copy Markdown
Collaborator Author

本轮已基于 PR diff 完成自审,结论如下。

代码变动审查

  • 未发现阻塞性问题。
  • 依赖治理部分是合理的:移除直接未使用的 requests 并同步刷新锁文件,符合 [Priority: Low] [Chore] 收敛 package typing、library logging 与导入型 smoke test #373 的 package hygiene 目标。安装产物里仍会出现 requests,这是上游依赖链带入的传递依赖,不构成当前 PR 的偏差。
  • NullHandler 的补充方式符合 Python library logging 最佳实践,放在 src/opencode_a2a/__init__.py 这一层也与当前对外导入面一致;tests/package/test_logging.py 对此做了明确约束。
  • py.typed 的发布链路完整:仓库内标记文件、pyproject.toml 中的 package data 声明、构建产物 smoke 验证三者是一致的,没有遗漏到“本地存在但 wheel/sdist 未携带”的常见问题。
  • scripts/smoke_test_built_cli.sh 的增强是正向改进:先在已安装工具环境里执行 import,再检查 /health,比只验证 CLI 启动更稳健;同时兼容 uv tool install 生成 bin/python 软链接,避免了 smoke test 对工具布局做过强假设。
  • 当前实现整体上和 [Priority: Low] [Chore] 收敛 package typing、library logging 与导入型 smoke test #373 想解决的问题一致,没有看到明显冗余实现,也没有发现需求偏差。

PR 标题与描述审查

  • PR 标题已调整为 chore: tighten package hygiene and packaging smoke coverage,与本次两组提交内容一致,符合 commit message 风格。
  • PR 描述已按 Package MetadataLogging BaselinePackaging Smoke TestTests And Validation 分模块整理,能够覆盖本 PR 的主要代码和验证动作。

Issue 关联审查

结论

  • 当前 PR 的实现方式较为稳健,验证链完整,可以进入正常评审流程。

@liujuanjuan1984 liujuanjuan1984 merged commit ae569cf into main Apr 2, 2026
3 checks passed
@liujuanjuan1984 liujuanjuan1984 deleted the chore/367-a2a-python-best-practices-review branch April 2, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Priority: Low] [Chore] 收敛 package typing、library logging 与导入型 smoke test

1 participant