diff --git a/python/cz_commitizen/__init__.py b/python/cz_commitizen/__init__.py index 94da2b9a8..ef775222d 100644 --- a/python/cz_commitizen/__init__.py +++ b/python/cz_commitizen/__init__.py @@ -1,6 +1,2 @@ # Copyright 2025 © BeeAI a Series of LF Projects, LLC # SPDX-License-Identifier: Apache-2.0 - -from cz_commitizen.monorepo_commits import MonorepoCommitsCz - -__all__ = ["MonorepoCommitsCz"] diff --git a/python/cz_commitizen/monorepo_commits.py b/python/cz_commitizen/monorepo_commits.py index dc157bdfc..586572cae 100644 --- a/python/cz_commitizen/monorepo_commits.py +++ b/python/cz_commitizen/monorepo_commits.py @@ -1,15 +1,18 @@ # Copyright 2025 © BeeAI a Series of LF Projects, LLC # SPDX-License-Identifier: Apache-2.0 +from __future__ import annotations + from collections.abc import Iterable -from typing import Any +from typing import TYPE_CHECKING, Any -from commitizen import git from commitizen.cz.conventional_commits import ConventionalCommitsCz # type: ignore __all__ = ["MonorepoCommitsCz"] -from commitizen.question import CzQuestion +if TYPE_CHECKING: + from commitizen import git + from commitizen.question import CzQuestion class MonorepoCommitsCz(ConventionalCommitsCz): @@ -24,6 +27,8 @@ class MonorepoCommitsCz(ConventionalCommitsCz): def changelog_message_builder_hook( self, parsed_message: dict[str, Any], commit: git.GitCommit ) -> dict[str, Any] | Iterable[dict[str, Any]] | None: + from commitizen import git + changed_files = git.get_filenames_in_commit(commit.rev) or [] has_python_changes = any(file.startswith("python/") for file in changed_files) diff --git a/python/pyproject.toml b/python/pyproject.toml index 54c26687a..3a10c494b 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -16,6 +16,12 @@ homepage = "https://framework.beeai.dev/" repository = "https://github.com/i-am-bee/beeai-framework" documentation = "https://i-am-bee.github.io/beeai-framework/#/python/" +[tool.poetry] +packages = [ + { include = "beeai_framework" }, + { include = "cz_commitizen" }, +] + [tool.poetry.dependencies] python = ">= 3.11,<3.14" a2a-sdk = {version = "^0.3.9", optional = true, extras = ["grpc", "http-server", "telemetry"]} @@ -192,7 +198,7 @@ requires = ["poetry-core>=2.0.0,<3.0.0"] build-backend = "poetry.core.masonry.api" [tool.poetry.plugins."commitizen.plugin"] -cz_monorepo_commits = "cz_commitizen:MonorepoCommitsCz" +cz_monorepo_commits = "cz_commitizen.monorepo_commits:MonorepoCommitsCz" [tool.ruff] lint.select = [ diff --git a/python/tasks.toml b/python/tasks.toml index ef87bb3f8..e8dc49510 100644 --- a/python/tasks.toml +++ b/python/tasks.toml @@ -82,7 +82,7 @@ outputs = { auto = true } depends = ["python:setup"] dir = "{{config_root}}/python" run = "rm -rf build dist 2>/dev/null; poetry build" -sources = ["beeai_framework/**/*.py"] +sources = ["beeai_framework/**/*.py", "cz_commitizen/**/*.py"] outputs = { auto = true } # test