Skip to content

Conversation

@LalatenduMohanty
Copy link
Member

Add provider description to error messages when resolution fails. Previously, errors from custom resolvers (GitHub, GitLab, etc.) were indistinguishable from PyPI resolver errors, making debugging difficult.

Closes: #858

@LalatenduMohanty LalatenduMohanty requested a review from a team as a code owner November 19, 2025 18:24
@mergify mergify bot added the ci label Nov 19, 2025
@LalatenduMohanty LalatenduMohanty force-pushed the 858 branch 2 times, most recently from 13998f8 to eb93e88 Compare November 19, 2025 18:47

raise resolvelib.resolvers.ResolverException(
f"found no match for {r}, searching for {file_type_info}, {prerelease_info} pre-release versions, in cache or at {self.sdist_server_url}"
f"found no match for {r} using {self.get_provider_description()}, searching for {file_type_info}, {prerelease_info} pre-release versions, in cache or at {self.sdist_server_url}"
Copy link
Member

Choose a reason for hiding this comment

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

The GitHub and gitlab providers inherit this method, and so are going to inherit this exception and its message. But the content of the message doesn't make sense for those providers, because they don't look at the sdist_server_url. So maybe more of this text should go into the PyPI provider description? Or it should be refactored in some other way to ensure that only the relevant information is included in the error message.

Copy link
Collaborator

Choose a reason for hiding this comment

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

... then format the description with self.provider_description.format(self=self)

Copy link
Member Author

@LalatenduMohanty LalatenduMohanty Nov 25, 2025

Choose a reason for hiding this comment

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

Tracing the inheritance:

  • BaseProvider._get_no_match_error_message() returns: "found no match for {r} using {self.get_provider_description()}"

  • PyPIProvider overrides it with a PyPI-specific message mentioning sdist_server_url

  • GenericProvider inherits from BaseProvider (doesn't override it)

  • GitHubTagProvider and GitLabTagProvider inherit from GenericProvider

Comment on lines 402 to 417
def get_provider_description(self) -> str:
"""Return a human-readable description of the provider type
This is used in error messages to indicate what resolver was being used.
"""
return type(self).__name__
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggestion: Instead of a callback, add provider_description: typing.ClassVar[str].


raise resolvelib.resolvers.ResolverException(
f"found no match for {r}, searching for {file_type_info}, {prerelease_info} pre-release versions, in cache or at {self.sdist_server_url}"
f"found no match for {r} using {self.get_provider_description()}, searching for {file_type_info}, {prerelease_info} pre-release versions, in cache or at {self.sdist_server_url}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

... then format the description with self.provider_description.format(self=self)

Comment on lines 777 to 779
def get_provider_description(self) -> str:
return f"GitHub tag resolver (repository: {self.organization}/{self.repo})"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
def get_provider_description(self) -> str:
return f"GitHub tag resolver (repository: {self.organization}/{self.repo})"
provider_description = "GitHub tag resolver (repository: {self.organization}/{self.repo})"

@LalatenduMohanty LalatenduMohanty force-pushed the 858 branch 3 times, most recently from dce7abd to 1143942 Compare November 25, 2025 04:16
Add provider description to error messages when resolution fails.
Previously, errors from custom resolvers (GitHub, GitLab, etc.) were
indistinguishable from PyPI resolver errors, making debugging difficult.

Closes: python-wheel-build#858

Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
@LalatenduMohanty
Copy link
Member Author

@tiran I have addressed your comments but have a little bit more to keep the log messages more user friendly. PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error for failed resolution with custom resolver is misleading

3 participants