fix(infra): package commitizen plugin entry point#1457
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces lazy loading for the MonorepoCommitsCz class and updates the build configuration to include the cz_commitizen package. Key changes include refactoring imports in monorepo_commits.py for better type checking and adding the package to pyproject.toml and tasks.toml. Feedback was provided regarding the proxy class implementation in init.py, noting that using new for lazy loading can hide class attributes and break inheritance checks. It is recommended to use module-level getattr instead to ensure the actual class is returned when accessed.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates the Python packaging/build configuration to include a new cz_commitizen package and adjusts Commitizen plugin code to avoid import-time dependencies.
Changes:
- Extend the build task inputs to watch
cz_commitizen/**Python sources. - Update Poetry packaging configuration to include both
beeai_frameworkandcz_commitizen. - Refactor Commitizen plugin imports (runtime import +
TYPE_CHECKING/ deferred annotations).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| python/tasks.toml | Adds cz_commitizen to build sources so artifacts rebuild when it changes. |
| python/pyproject.toml | Attempts to configure Poetry to package cz_commitizen alongside beeai_framework. |
| python/cz_commitizen/monorepo_commits.py | Defers commitizen.git import to runtime and uses deferred annotations. |
| python/cz_commitizen/init.py | Changes export of MonorepoCommitsCz to a lazy factory wrapper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: pragnyanramtha <pragnyanramtha@gmail.com>
e91dc16 to
caabf18
Compare
Summary
cz_commitizenhelper package in the Python wheel so the published Commitizen entry point resolvescz_commitizen/**/*.pyas a Python build sourceCloses #1454.
Validation
uv build --wheelcommitizen, thencz commit --helpcommitizen, thencz check --message 'fix: packaging test'\n- isolated wheel install withcommitizen, then verifiedcommitizen.cz.registry['cz_monorepo_commits']resolves tocz_commitizen.monorepo_commits.MonorepoCommitsCzand exposeschange_type_map\n- inspected the rebuilt wheel to confirmcz_commitizen/__init__.py,cz_commitizen/monorepo_commits.py, and the updatedcommitizen.pluginentry point are present\n-uv run --no-project --with ruff ruff check cz_commitizen\n-uv run --no-project --with ruff ruff format --check cz_commitizen\n-uv run --no-project --with pyrefly --with commitizen pyrefly check cz_commitizen\n-git diff --check\n\nNote: I could not run the documentedmisetasks in this workspace becausemiseis not installed, so I used the focused build/lint/type/plugin-discovery checks above.