Skip to content

feat: ✨ Add ProfileLoader.required_module_names method#253

Merged
remimd merged 1 commit intodevfrom
required_module_names
May 29, 2025
Merged

feat: ✨ Add ProfileLoader.required_module_names method#253
remimd merged 1 commit intodevfrom
required_module_names

Conversation

@remimd
Copy link
Copy Markdown
Member

@remimd remimd commented May 29, 2025

No description provided.

@remimd remimd requested a review from Copilot May 29, 2025 08:46
@remimd remimd self-assigned this May 29, 2025
@remimd remimd merged commit b6f5d8f into dev May 29, 2025
5 checks passed
@remimd remimd deleted the required_module_names branch May 29, 2025 08:47
@remimd remimd review requested due to automatic review settings May 29, 2025 08:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new method to collect all required module names, including their nested subsets, and adds tests for both default and named scenarios.

  • Implemented ProfileLoader.required_module_names with a helper __walk_subsets_for.
  • Added two unit tests to verify the returned set of module names.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/loaders/test_profile_loader.py Added tests for default and named required modules
injection/loaders.py Implemented required_module_names and subset walker
Comments suppressed due to low confidence (3)

injection/loaders.py:158

  • [nitpick] The generator expression reuses name, shadowing the method parameter. Rename the inner loop variable (e.g. for module_name in names) to avoid confusion.
        subsets = (self.__walk_subsets_for(name) for name in names)

tests/loaders/test_profile_loader.py:14

  • Calling mod() multiple times produces distinct modules with different names. Assign a single module instance to a variable (e.g. module = mod()), use module.name in the mapping, and then reuse that same variable in the expected set to ensure consistency.
                mod().name: ["a", "b", "c"],

tests/loaders/test_profile_loader.py:21

  • Same issue as above: this call to mod().name creates a new instance. Reference the earlier module variable to compare the correct name.
            mod().name,

Comment thread injection/loaders.py
def __is_empty(self) -> bool:
return not self.module_subsets

def required_module_names(self, name: str | None = None, /) -> frozenset[str]:
Copy link

Copilot AI May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a docstring for required_module_names to explain its parameters (including name=None) and the structure of its return value, making its behavior clearer to future readers.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants