Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: restructure resolver logic and improve type safety #1323

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

leseb
Copy link
Contributor

@leseb leseb commented Feb 28, 2025

What does this PR do?

  • Modularized resolve_impls by extracting helper functions for validation, sorting, and instantiation.
  • Improved readability by introducing validate_and_prepare_providers, sort_providers_by_dependency, and instantiate_providers.
  • Enhanced type safety with explicit type hints (Tuple, Dict, Set, etc.).
  • Fixed potential issues with provider module imports and added error handling.
  • Updated pyproject.toml to enforce type checking on resolver.py using mypy.

Signed-off-by: Sébastien Han [email protected]

Test Plan

Run the server.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 28, 2025
Copy link
Contributor

@ashwinb ashwinb left a comment

Choose a reason for hiding this comment

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

nice, thanks for tackling and cleaning this!

- Modularized `resolve_impls` by extracting helper functions for
  validation, sorting, and instantiation.
- Improved readability by introducing
  `validate_and_prepare_providers`, `sort_providers_by_dependency`, and
  `instantiate_providers`.
- Enhanced type safety with explicit type hints (`Tuple`, `Dict`,
  `Set`, etc.).
- Fixed potential issues with provider module imports and added error
  handling.
- Updated `pyproject.toml` to enforce type checking on `resolver.py`
  using `mypy`.

Signed-off-by: Sébastien Han <[email protected]>
@leseb leseb force-pushed the simplify-resolver branch from a9e3a50 to d04b477 Compare March 3, 2025 10:10
@leseb leseb requested a review from ashwinb March 3, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants