diff --git a/components/polylith/alias/core.py b/components/polylith/alias/core.py index 4b3c647d..370291fa 100644 --- a/components/polylith/alias/core.py +++ b/components/polylith/alias/core.py @@ -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, []) diff --git a/projects/poetry_polylith_plugin/pyproject.toml b/projects/poetry_polylith_plugin/pyproject.toml index c3607154..e4000898 100644 --- a/projects/poetry_polylith_plugin/pyproject.toml +++ b/projects/poetry_polylith_plugin/pyproject.toml @@ -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/" diff --git a/projects/polylith_cli/pyproject.toml b/projects/polylith_cli/pyproject.toml index f04b87f6..98e4d90b 100644 --- a/projects/polylith_cli/pyproject.toml +++ b/projects/polylith_cli/pyproject.toml @@ -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/" diff --git a/test/components/polylith/alias/test_alias.py b/test/components/polylith/alias/test_alias.py index 1c7a7aa1..e97b98eb 100644 --- a/test/components/polylith/alias/test_alias.py +++ b/test/components/polylith/alias/test_alias.py @@ -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 = {}