From 467cb32d254c55cde2a9b0679f744c0fac292df7 Mon Sep 17 00:00:00 2001 From: David Vujic Date: Tue, 3 Dec 2024 13:52:02 +0100 Subject: [PATCH] feat(hatch): add support for editable installs (#306) * feat(hatch): add support for editable installs * bump Hatch hook to 1.3.0 --- components/polylith/hatch/hooks/bricks.py | 7 ++++--- projects/hatch_polylith_bricks/pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/polylith/hatch/hooks/bricks.py b/components/polylith/hatch/hooks/bricks.py index 986a94b1..2d3149ba 100644 --- a/components/polylith/hatch/hooks/bricks.py +++ b/components/polylith/hatch/hooks/bricks.py @@ -10,7 +10,8 @@ class PolylithBricksHook(BuildHookInterface): PLUGIN_NAME = "polylith-bricks" - def initialize(self, _version: str, build_data: Dict[str, Any]) -> None: + def initialize(self, version: str, build_data: Dict[str, Any]) -> None: + include_key = "force_include_editable" if version == "editable" else "force_include" root = self.root pyproject = Path(f"{root}/{repo.default_toml}") @@ -25,7 +26,7 @@ def initialize(self, _version: str, build_data: Dict[str, Any]) -> None: work_dir = core.get_work_dir(self.config) if not top_ns: - build_data["force_include"] = bricks + build_data[include_key] = bricks return ns = parsing.parse_brick_namespace_from_path(bricks) @@ -38,7 +39,7 @@ def initialize(self, _version: str, build_data: Dict[str, Any]) -> None: print(f"Updated {item} with new top namespace for local imports.") key = work_dir.as_posix() - build_data["force_include"][key] = top_ns + build_data[include_key][key] = top_ns def finalize(self, *args, **kwargs) -> None: work_dir = core.get_work_dir(self.config) diff --git a/projects/hatch_polylith_bricks/pyproject.toml b/projects/hatch_polylith_bricks/pyproject.toml index 81133d46..60517265 100644 --- a/projects/hatch_polylith_bricks/pyproject.toml +++ b/projects/hatch_polylith_bricks/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "hatch-polylith-bricks" -version = "1.2.10" +version = "1.3.0" description = "Hatch build hook plugin for Polylith" authors = ['David Vujic'] homepage = "https://davidvujic.github.io/python-polylith-docs/"