Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion components/polylith/alias/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def parse(aliases: List[str]) -> Dict[str, List[str]]:


def pick(aliases: Dict[str, List[str]], keys: Set) -> Set:
matrix = [v for k, v in aliases.items() if k in keys]
normalized_keys = {str.lower(k) for k in keys}

matrix = [v for k, v in aliases.items() if str.lower(k) in normalized_keys]

flattened: List = sum(matrix, [])

Expand Down
2 changes: 1 addition & 1 deletion projects/poetry_polylith_plugin/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "poetry-polylith-plugin"
version = "1.25.0"
version = "1.25.1"
description = "A Poetry plugin that adds tooling support for the Polylith Architecture"
authors = ["David Vujic"]
homepage = "https://davidvujic.github.io/python-polylith-docs/"
Expand Down
2 changes: 1 addition & 1 deletion projects/polylith_cli/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "polylith-cli"
version = "1.12.0"
version = "1.12.1"
description = "Python tooling support for the Polylith Architecture"
authors = ['David Vujic']
homepage = "https://davidvujic.github.io/python-polylith-docs/"
Expand Down
15 changes: 15 additions & 0 deletions test/components/polylith/alias/test_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,21 @@ def test_pick_aliases_by_keys():
assert res == {"cv2", "mpl_toolkits", "matplotlib"}


def test_pick_aliases_by_case_insensitive_keys():
aliases = {
"opencv-python": ["cv2"],
"PyJWT": ["jwt"],
"Jinja2": ["jinja2"],
"PyYAML": ["_yaml", "yaml"],
}

keys = {"one", "two", "jinja2", "pyyaml", "opencv-python", "pyjwt"}

res = alias.pick(aliases, keys)

assert res == {"cv2", "jinja2", "jwt", "_yaml", "yaml"}


def test_pick_empty_alias_by_keys():
aliases = {}

Expand Down