Skip to content

feat(resolver): enhance resolver proposal and model#1228

Merged
mergify[bot] merged 1 commit into
python-wheel-build:mainfrom
tiran:tiran/resolver-provider-req
Jul 7, 2026
Merged

feat(resolver): enhance resolver proposal and model#1228
mergify[bot] merged 1 commit into
python-wheel-build:mainfrom
tiran:tiran/resolver-provider-req

Conversation

@tiran

@tiran tiran commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Pull Request Description

What

The resolver_provider method now accepts a req argument, so it can retriebe a PBI from the context.

Resolvers have a download_kind, resolves_prebuilt_wheel, and supports_override_hooks attribute. Consumers can use the attributes to figure out what kinds of artifacts a resolver downloads.

Split HookResolver into HookSDistResolver (hook-sdist) and HookPrebuiltResolver (hook-prebuilt) for source vs pre-built wheel artifacts. Before the code assumed that hooks were limited to sdists.

Clarify that git clone operations use git_clone_fast, which retrieves all git submodules recursively.

Why

Address some short-comings and issues found by Shanmukh.

@tiran
tiran requested a review from a team as a code owner July 3, 2026 09:20
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@tiran, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3888721c-3ac3-4b2f-995f-ebaf2e8db5c5

📥 Commits

Reviewing files that changed from the base of the PR and between d1f7a73 and 5a9149d.

📒 Files selected for processing (5)
  • docs/proposals/new-resolver-config.md
  • docs/reference/config-reference.rst
  • src/fromager/packagesettings/__init__.py
  • src/fromager/packagesettings/_resolver.py
  • tests/test_packagesettings_resolver.py
📝 Walkthrough

Walkthrough

This PR replaces the generic HookResolver with two specialized hook-based resolvers, HookSDistResolver and HookPrebuiltResolver. It introduces a DownloadKind enum applied across all resolver classes, and updates the resolver_provider method signature throughout to accept a Requirement argument. Package exports, tests, and documentation (proposal doc and config reference) are updated accordingly.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Changes

Cohort / File(s) Summary
Resolver core (_resolver.py) Adds DownloadKind enum, updates AbstractResolver, all PyPI/GitHub/GitLab resolvers, NotAvailableResolver, and adds HookSDistResolver/HookPrebuiltResolver replacing HookResolver
Package exports (__init__.py) Updates imports and __all__ to expose DownloadKind, HookSDistResolver, HookPrebuiltResolver; removes HookResolver
Tests (test_packagesettings_resolver.py) Adds _REQ constant, updates all resolver_provider calls, adds assertions for new attributes, adds hook resolver test classes
Documentation (new-resolver-config.md, config-reference.rst) Documents new hook profiles, updated provider names, git clone behavior, and DownloadKind variants

Sequence Diagram(s)

sequenceDiagram
  participant Config
  participant SourceResolver
  participant HookSDistResolver
  participant HookPrebuiltResolver
  Config->>SourceResolver: provider hook-sdist or hook-prebuilt
  SourceResolver->>HookSDistResolver: resolver_provider(ctx, req, req_type)
  SourceResolver->>HookPrebuiltResolver: resolver_provider(ctx, req, req_type)
  HookSDistResolver-->>Config: NotImplementedError
  HookPrebuiltResolver-->>Config: NotImplementedError
Loading

Related issues: None specified.

Related PRs: None specified.

Suggested labels: documentation, enhancement

Suggested reviewers: None specified.

Poem:
A hare hopped through the resolver den,
Split one hook into two, and then again,
Sdist here, prebuilt there,
Requirements passed with care,
Tests hopped along, download_kind in tow — good code, my friend! 🐇

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately summarizes the resolver proposal/model changes.
Description check ✅ Passed The description clearly matches the resolver API, hook split, and git clone updates in the changeset.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify mergify Bot added the ci label Jul 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/fromager/packagesettings/_resolver.py (1)

31-39: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add versionadded directives to the new public resolvers/enum.

DownloadKind, HookSDistResolver, and HookPrebuiltResolver are user-facing (surfaced in the config reference docs) but their docstrings lack version directives.

As per coding guidelines: "Use Sphinx versionadded, versionremoved, versionchanged directives for user-facing changes".

Also applies to: 585-619

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fromager/packagesettings/_resolver.py` around lines 31 - 39, Add Sphinx
versionadded directives to the user-facing docstrings for DownloadKind,
HookSDistResolver, and HookPrebuiltResolver, since these are surfaced in the
config reference. Update the class/enum docstrings in _resolver.py so each newly
public resolver/enum clearly documents when it was introduced, following the
project’s version directive convention.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/fromager/packagesettings/_resolver.py`:
- Around line 58-60: The base resolver API is inconsistent because
resolves_prebuilt_wheel is currently a method in the resolver class while
subclasses expose it as a boolean attribute, so attribute access on base
resolvers yields a bound method instead of a falsey value. Update
resolves_prebuilt_wheel on the resolver class to be a property so it matches the
subclass API and keeps r.resolves_prebuilt_wheel behaving as a boolean across
all resolver types.

In `@tests/test_packagesettings_resolver.py`:
- Around line 472-475: The resolver_provider test only checks the generic “not
available” text, so the new NotAvailableResolver behavior that includes req in
the error message is unverified. Strengthen test_resolver_provider in the
resolver_provider path by asserting the raised ValueError message includes the
specific requirement value from _REQ (and still matches the unavailable text),
using the existing _parse, tmp_context, and resolver_provider call to confirm
the req is surfaced in the error.
- Around line 95-97: The `AbstractResolver.resolves_prebuilt_wheel` API is still
a method, so the current assertions in this test are checking a bound method
object instead of a boolean. Update the base resolver API to a `@property` if
that is the intended contract, or change the test to call
`resolves_prebuilt_wheel()` consistently; use `AbstractResolver`,
`supports_override_hooks`, and `resolves_prebuilt_wheel` to locate the relevant
code and keep the assertion style aligned with the actual interface.

---

Nitpick comments:
In `@src/fromager/packagesettings/_resolver.py`:
- Around line 31-39: Add Sphinx versionadded directives to the user-facing
docstrings for DownloadKind, HookSDistResolver, and HookPrebuiltResolver, since
these are surfaced in the config reference. Update the class/enum docstrings in
_resolver.py so each newly public resolver/enum clearly documents when it was
introduced, following the project’s version directive convention.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6440c7b0-89f1-429a-8feb-fc176fd15f8b

📥 Commits

Reviewing files that changed from the base of the PR and between c9ddc51 and d1f7a73.

📒 Files selected for processing (5)
  • docs/proposals/new-resolver-config.md
  • docs/reference/config-reference.rst
  • src/fromager/packagesettings/__init__.py
  • src/fromager/packagesettings/_resolver.py
  • tests/test_packagesettings_resolver.py

Comment thread src/fromager/packagesettings/_resolver.py
Comment thread tests/test_packagesettings_resolver.py
Comment thread tests/test_packagesettings_resolver.py
@tiran
tiran force-pushed the tiran/resolver-provider-req branch from d1f7a73 to 850bd2f Compare July 3, 2026 10:17
@rd4398
rd4398 requested a review from smoparth July 6, 2026 13:00

@smoparth smoparth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thank you!

@rd4398 rd4398 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good and aligns with what we discussed

@mergify

mergify Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@mergify

mergify Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

queue

⚠️ Configuration not compatible with a branch protection setting

Details

The branch protection setting Require branches to be up to date before merging is not compatible with draft PR checks. To keep this branch protection enabled, update your Mergify configuration to enable in-place checks: set merge_queue.max_parallel_checks: 1, set every queue rule batch_size: 1, and avoid two-step CI (make merge_conditions identical to queue_conditions). Otherwise, disable this branch protection.

@tiran

tiran commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

@Mergifyio rebase

@mergify

mergify Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

rebase

🛑 The pull request rule doesn't match anymore

Details

This action has been cancelled.

Address some short-comings and issues found by Shanmukh.

The `resolver_provider` method now accepts a `req` argument, so it can
retriebe a PBI from the context.

Resolvers have a `download_kind`, `resolves_prebuilt_wheel`, and
`supports_override_hooks` attribute. Consumers can use the attributes to
figure out what kinds of artifacts a resolver downloads.

Split `HookResolver` into `HookSDistResolver` (hook-sdist) and
`HookPrebuiltResolver` (hook-prebuilt) for source vs pre-built wheel
artifacts. Before the code assumed that hooks were limited to sdists.

Clarify that git clone operations use `git_clone_fast`, which retrieves
all git submodules recursively.

Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Christian Heimes <cheimes@redhat.com>
@tiran
tiran force-pushed the tiran/resolver-provider-req branch from 850bd2f to 5a9149d Compare July 7, 2026 09:30
@mergify
mergify Bot merged commit 90322fe into python-wheel-build:main Jul 7, 2026
38 of 39 checks passed
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.

3 participants