Skip to content

Commit 8c80a94

Browse files
authored
fix: poly check performance improvement (#356)
* fix(poly check): move caching one level up, to skip re-running AST walking and parsing * bump Poetry plugin to 1.38.1 * bump CLI to 1.31.1
1 parent 6a008bb commit 8c80a94

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

components/polylith/imports/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def parse_imports(node: ast.AST) -> List[str]:
3030
return []
3131

3232

33-
@lru_cache(maxsize=None)
3433
def parse_module(path: Path) -> ast.AST:
3534
with open(path.as_posix(), "r", encoding="utf-8", errors="ignore") as f:
3635
tree = ast.parse(f.read(), path.name)
@@ -48,6 +47,7 @@ def is_python_file(path: Path) -> bool:
4847
return path.is_file() and path.suffix == ".py"
4948

5049

50+
@lru_cache(maxsize=None)
5151
def list_imports(path: Path) -> Set[str]:
5252
py_modules = [path] if is_python_file(path) else path.rglob("*.py")
5353

projects/poetry_polylith_plugin/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 = "poetry-polylith-plugin"
3-
version = "1.38.0"
3+
version = "1.38.1"
44
description = "A Poetry plugin that adds tooling support for the Polylith Architecture"
55
authors = ["David Vujic"]
66
homepage = "https://davidvujic.github.io/python-polylith-docs/"

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.0"
3+
version = "1.31.1"
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)