Skip to content

refactor(structure): migrate Python package to monorepo layout#98

Open
Cloxl wants to merge 2 commits intomasterfrom
fix/issue-96
Open

refactor(structure): migrate Python package to monorepo layout#98
Cloxl wants to merge 2 commits intomasterfrom
fix/issue-96

Conversation

@Cloxl
Copy link
Owner

@Cloxl Cloxl commented Jan 21, 2026

Fixes #96

Summary by Sourcery

将该 Python 包迁移到 monorepo 的子目录中,并将其从基于 VCS 的版本管理切换为静态版本管理。

Enhancements:

  • 更新 Python 包的元数据,使用固定版本号替代基于 VCS 的动态版本号。
  • 为 Python 包新增完整的 README 文档,包括使用示例和开发流程说明。

Build:

  • 将 Python 打包配置和锁定文件移动到 monorepo 的 packages/python/ 目录中,并通过移除 VCS 插件来简化构建系统的依赖要求。

Documentation:

  • packages/python/README.md 中为 Python 包新增详细的用户与开发者文档。
Original summary in English

Summary by Sourcery

Migrate the Python package into a monorepo subdirectory and switch it from VCS-based to static versioning.

Enhancements:

  • Update Python package metadata to use a fixed version instead of VCS-based dynamic versioning.
  • Add comprehensive README documentation for the Python package, including usage examples and development workflow.

Build:

  • Relocate Python packaging configuration and lockfile into the monorepo packages/python/ directory and simplify build-system requirements by removing the VCS plugin.

Documentation:

  • Add detailed user and developer documentation for the Python package in packages/python/README.md.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 21, 2026

Reviewer's Guide

将该 Python 项目重构为类似 monorepo 的 packages/python 子目录结构,调整打包配置以不再依赖基于 VCS 的版本管理,并在新的包路径下添加面向用户的包文档,同时迁移锁文件和相关配置文件。

File-Level Changes

Change Details Files
将 Python 包配置和锁文件移动到类似 monorepo 的 packages/python 目录布局中,并将版本管理与 VCS 解耦。
  • pyproject.toml 从仓库根目录迁移到 packages/python/pyproject.toml,在必要时更新路径的同时保留构建系统和项目配置。
  • 从构建系统依赖中移除 hatch-vcs,以停止使用基于 VCS 的版本管理。
  • uv.lock 迁移到 packages/python/uv.lock,使依赖范围限定在 monorepo 中的 Python 包。
pyproject.toml
packages/python/pyproject.toml
uv.lock
packages/python/uv.lock
从动态的基于 VCS 的版本管理切换为固定的显式项目版本,并移除相关配置。
  • 在项目元数据中,用设为 0.1.8 的静态 version 字段替换动态版本配置。
  • 移除配置 VCS 作为版本来源的 [tool.hatch.version] 部分。
  • 移除在构建过程中生成版本文件的 [tool.hatch.build.hooks.vcs] 部分。
packages/python/pyproject.toml
在 monorepo 布局中为 Python 包新增范围清晰的完整 README 文档。
  • packages/python 下新增 README.md,其中包含 xhshow 库的安装说明、使用示例、会话管理细节、签名解码、定制化,以及开发流程相关文档。
  • 在新的包级 README 中链接现有项目资源,如 issue、功能建议和许可证等。
packages/python/README.md
调整仓库根目录的忽略规则,使其与 monorepo 结构保持一致(若 .gitignore diff 中存在相应变更)。
  • 审查 .gitignore 更新,确保新的包路径(例如 packages/python)以及被迁移的构建产物能够按照预期被忽略或追踪。
.gitignore

Assessment against linked issues

Issue Objective Addressed Explanation
#96 将仓库重构为 monorepo 布局,以便不同语言的实现(如 Python/Go/TS)位于各自独立的包中。
#96 在 monorepo 中新增 xhshow 功能的 Go 实现/包。 该 PR 仅将现有的 Python 包迁移到 packages/python 并调整其配置和文档。未新增任何 Go 源文件、模块或配置。
#96 在 monorepo 中新增 xhshow 功能的 TypeScript 实现/包。 该 PR 未引入任何 TypeScript 代码、package.json 或相关的 TS 构建/测试配置;仅对 Python 包进行了重组。

Tips and commands

Interacting with Sourcery

  • 触发新的代码评审: 在 Pull Request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的评审评论。
  • 从评审评论生成 GitHub issue: 在某条评审评论下回复,要求 Sourcery 从该评论创建 issue。你也可以直接回复 @sourcery-ai issue,从该评论生成 issue。
  • 生成 Pull Request 标题: 在 Pull Request 标题中任意位置写上 @sourcery-ai 即可随时生成标题。你也可以在 Pull Request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 Pull Request 摘要: 在 Pull Request 内容中任意位置写上 @sourcery-ai summary,即可在对应位置生成 PR 摘要。你也可以在 Pull Request 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成评审者指南: 在 Pull Request 中评论 @sourcery-ai guide,即可随时(重新)生成评审者指南。
  • 一次性解决所有 Sourcery 评论: 在 Pull Request 中评论 @sourcery-ai resolve,即可将所有 Sourcery 评论标记为已解决。如果你已经处理了所有评论且不想再看到它们,这会很有用。
  • 一次性撤销所有 Sourcery 评审: 在 Pull Request 中评论 @sourcery-ai dismiss,即可撤销所有现有的 Sourcery 评审。特别适用于你希望从一次全新的评审开始——别忘了再评论 @sourcery-ai review 来触发新的评审!

Customizing Your Experience

进入你的 dashboard 以:

  • 启用或禁用评审功能,例如 Sourcery 生成的 Pull Request 摘要、评审者指南等。
  • 更改评审语言。
  • 添加、删除或编辑自定义评审说明。
  • 调整其他评审设置。

Getting Help

Original review guide in English

Reviewer's Guide

Refactors the Python project into a monorepo-style packages/python subdirectory, adjusts packaging configuration away from VCS-based versioning, and adds user-facing package documentation within the new package path while relocating lockfile and related config files.

File-Level Changes

Change Details Files
Move Python package configuration and lockfile into a monorepo-style packages/python layout and decouple versioning from VCS.
  • Relocate pyproject.toml from repository root into packages/python/pyproject.toml, preserving build-system and project configuration while updating paths as needed.
  • Remove hatch-vcs from the build-system requirements to stop using VCS-based version management.
  • Relocate uv.lock into packages/python/uv.lock to scope dependencies to the Python package within the monorepo.
pyproject.toml
packages/python/pyproject.toml
uv.lock
packages/python/uv.lock
Switch from dynamic VCS-based versioning to a fixed, explicit project version and remove related configuration.
  • Replace dynamic version configuration with a static version field set to 0.1.8 in the project metadata.
  • Remove the [tool.hatch.version] section that configured VCS as the version source.
  • Remove the [tool.hatch.build.hooks.vcs] section that generated a version file during builds.
packages/python/pyproject.toml
Add comprehensive README documentation scoped to the Python package within the monorepo layout.
  • Introduce a new README.md under packages/python containing installation, usage examples, session management details, signature decoding, customization, and development workflow documentation for the xhshow library.
  • Link to existing project resources such as issues, feature suggestions, and license from the new package-level README.
packages/python/README.md
Adjust repository root ignore rules to align with the monorepo structure (if any changes present in the .gitignore diff).
  • Review .gitignore updates to ensure new package paths (e.g., packages/python) and relocated artifacts are correctly ignored or tracked as intended.
.gitignore

Assessment against linked issues

Issue Objective Addressed Explanation
#96 Restructure the repository into a monorepo layout so that language-specific implementations (e.g., Python/Go/TS) live under separate packages.
#96 Add a Go implementation/package of the xhshow functionality within the monorepo. The PR only migrates the existing Python package into packages/python and adjusts its configuration and docs. There are no Go source files, modules, or configuration added.
#96 Add a TypeScript implementation/package of the xhshow functionality within the monorepo. The PR does not introduce any TypeScript code, package.json, or related TS build/test configuration; it only reorganizes the Python package.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我在这里给出了一些总体反馈:

  • version = "0.1.8" 写死并移除 hatch-vcs/动态版本管理,意味着之后需要手动更新版本号;如果你想在 monorepo 场景下避免 tag 与已发布包版本号之间出现偏差,建议保留基于 VCS 或其他集中式的版本管理方案。
供 AI Agent 使用的提示词
Please address the comments from this code review:

## Overall Comments
- Hardcoding `version = "0.1.8"` and removing `hatch-vcs`/dynamic versioning will require manual bumps going forward; consider keeping VCS-based or other centralized version management if you want to avoid divergence between tags and the published package version in a monorepo setup.

Sourcery 对开源项目是免费的——如果你觉得这次代码审查有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进之后的代码审查。
Original comment in English

Hey - I've left some high level feedback:

  • Hardcoding version = "0.1.8" and removing hatch-vcs/dynamic versioning will require manual bumps going forward; consider keeping VCS-based or other centralized version management if you want to avoid divergence between tags and the published package version in a monorepo setup.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Hardcoding `version = "0.1.8"` and removing `hatch-vcs`/dynamic versioning will require manual bumps going forward; consider keeping VCS-based or other centralized version management if you want to avoid divergence between tags and the published package version in a monorepo setup.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

[Feature]: monorepo支持

1 participant