Skip to content

Commit 467cb32

Browse files
authored
feat(hatch): add support for editable installs (#306)
* feat(hatch): add support for editable installs * bump Hatch hook to 1.3.0
1 parent ad127b5 commit 467cb32

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

components/polylith/hatch/hooks/bricks.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
class PolylithBricksHook(BuildHookInterface):
1111
PLUGIN_NAME = "polylith-bricks"
1212

13-
def initialize(self, _version: str, build_data: Dict[str, Any]) -> None:
13+
def initialize(self, version: str, build_data: Dict[str, Any]) -> None:
14+
include_key = "force_include_editable" if version == "editable" else "force_include"
1415
root = self.root
1516
pyproject = Path(f"{root}/{repo.default_toml}")
1617

@@ -25,7 +26,7 @@ def initialize(self, _version: str, build_data: Dict[str, Any]) -> None:
2526
work_dir = core.get_work_dir(self.config)
2627

2728
if not top_ns:
28-
build_data["force_include"] = bricks
29+
build_data[include_key] = bricks
2930
return
3031

3132
ns = parsing.parse_brick_namespace_from_path(bricks)
@@ -38,7 +39,7 @@ def initialize(self, _version: str, build_data: Dict[str, Any]) -> None:
3839
print(f"Updated {item} with new top namespace for local imports.")
3940

4041
key = work_dir.as_posix()
41-
build_data["force_include"][key] = top_ns
42+
build_data[include_key][key] = top_ns
4243

4344
def finalize(self, *args, **kwargs) -> None:
4445
work_dir = core.get_work_dir(self.config)

projects/hatch_polylith_bricks/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "hatch-polylith-bricks"
3-
version = "1.2.10"
3+
version = "1.3.0"
44
description = "Hatch build hook plugin for Polylith"
55
authors = ['David Vujic']
66
homepage = "https://davidvujic.github.io/python-polylith-docs/"

0 commit comments

Comments
 (0)