Skip to content

Commit

Permalink
feat(hatch): add support for editable installs (#306)
Browse files Browse the repository at this point in the history
* feat(hatch): add support for editable installs

* bump Hatch hook to 1.3.0
  • Loading branch information
DavidVujic authored Dec 3, 2024
1 parent ad127b5 commit 467cb32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions components/polylith/hatch/hooks/bricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion projects/hatch_polylith_bricks/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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/"
Expand Down

0 comments on commit 467cb32

Please sign in to comment.