Skip to content

Commit 7c4c4b8

Browse files
authored
fix(rewrite): add module name to alias for plain imports and when not already using alias (#358)
* fix(rewrite): add module name to alias for plain imports and when not already using alias * bump hatch bricks hook to 1.5.2 * bump pdm bricks hook to 1.3.2 * bump pdm workspace hook to 1.3.2 * bump CLI to 1.31.2
1 parent 8c80a94 commit 7c4c4b8

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

components/polylith/parsing/rewrite.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ def mutate_import(node: ast.Import, ns: str, top_ns: str) -> bool:
1313

1414
for alias in node.names:
1515
if alias.name == ns:
16+
if alias.asname is None:
17+
alias.asname = alias.name
18+
1619
alias.name = create_namespace_path(top_ns, alias.name)
1720
did_mutate = True
1821

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.5.1"
3+
version = "1.5.2"
44
description = "Hatch build hook plugin for Polylith"
55
authors = ['David Vujic']
66
homepage = "https://davidvujic.github.io/python-polylith-docs/"

projects/pdm_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 = "pdm-polylith-bricks"
3-
version = "1.3.1"
3+
version = "1.3.2"
44
description = "a PDM build hook for Polylith"
55
authors = ["David Vujic"]
66
homepage = "https://davidvujic.github.io/python-polylith-docs/"

projects/pdm_polylith_workspace/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 = "pdm-polylith-workspace"
3-
version = "1.3.1"
3+
version = "1.3.2"
44
description = "a PDM build hook for a Polylith workspace"
55
homepage = "https://davidvujic.github.io/python-polylith-docs/"
66
repository = "https://github.com/davidvujic/python-polylith"

projects/polylith_cli/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 = "polylith-cli"
3-
version = "1.31.1"
3+
version = "1.31.2"
44
description = "Python tooling support for the Polylith Architecture"
55
authors = ['David Vujic']
66
homepage = "https://davidvujic.github.io/python-polylith-docs/"

0 commit comments

Comments
 (0)