Skip to content

feat(resolver): add download method to all resolver classes#1235

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

feat(resolver): add download method to all resolver classes#1235
mergify[bot] merged 1 commit into
python-wheel-build:mainfrom
tiran:resolver-download

Conversation

@tiran

@tiran tiran commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Pull Request Description

What

Add _download() to AbstractResolver that dispatches to the
appropriate download helper based on a mandatory download_kind
argument. Each concrete resolver implements a public download()
that delegates with its specific DownloadKind.

  • PyPIDownloadResolver accepts download_kind as a mandatory
    Pydantic field (restricted to sdist | tarball)
  • NotAvailableResolver and AbstractHookResolver override
    download() to raise explicitly
  • Replace the old download_kind ClassVar with a download_kinds
    frozenset ClassVar describing which kinds each resolver can return
  • Replace resolves_prebuilt_wheel property with a ClassVar
  • Validate download_kind against download_kinds in _download()

Why

Include the download logic in the resolver.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6fa95054-6162-4f64-91e5-508a4b4fdc03

📥 Commits

Reviewing files that changed from the base of the PR and between c378fa9 and ed032d1.

📒 Files selected for processing (3)
  • docs/reference/config-reference.rst
  • src/fromager/packagesettings/_resolver.py
  • tests/test_packagesettings_resolver.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/test_packagesettings_resolver.py
  • src/fromager/packagesettings/_resolver.py

📝 Walkthrough

Walkthrough

This PR replaces resolver download_kind metadata with download_kinds sets in _resolver.py, adds a DownloadKindSet alias, and moves download handling into a centralized _download() dispatcher. Concrete resolvers now implement download() and advertise supported kinds explicitly. Tests were updated to use shared Candidate fixtures, mock downloader helpers, assert (path, kind) results, and verify the new error paths. The reference docs now list download_kinds and resolves_prebuilt_wheel.

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

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a download method across resolver classes.
Description check ✅ Passed The description accurately describes the resolver download refactor and is clearly related to the changeset.
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.

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 7, 2026
@tiran tiran force-pushed the resolver-download branch from 156f145 to c378fa9 Compare July 7, 2026 15:15
@tiran tiran marked this pull request as ready for review July 7, 2026 15:16
@tiran tiran requested a review from a team as a code owner July 7, 2026 15:16

@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: 2

🤖 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 300-301: The download_kind field in the resolver settings is now
required but existing pypi-download configs may omit it, so either give it a
backward-compatible default in the relevant resolver settings class or treat
this as an intentional config break and document it with a versionchanged note
in the class docstring. Update the field definition in the package settings
resolver so loading configs that don’t specify download_kind continues to work,
or clearly signal the breaking change if compatibility is not preserved.

In `@tests/test_packagesettings_resolver.py`:
- Around line 302-315: The resolver test coverage is missing the `download_kind:
sdist` execution path, so `download()` is never verified to dispatch through
`download_sdist` instead of the tarball helper. Add a new test alongside
`test_download` that configures the resolver with `download_kind: sdist`,
patches `fromager.downloads.download_sdist`, and asserts the returned path/kind
plus the expected call arguments. Use the existing `download()` method and
`_parse()` setup to keep the new case aligned with the current resolver tests.
🪄 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: 881e8a75-c367-4165-807e-7dc692fd2e20

📥 Commits

Reviewing files that changed from the base of the PR and between dbcd337 and c378fa9.

📒 Files selected for processing (2)
  • src/fromager/packagesettings/_resolver.py
  • tests/test_packagesettings_resolver.py

Comment thread src/fromager/packagesettings/_resolver.py
Comment thread tests/test_packagesettings_resolver.py
@tiran tiran force-pushed the resolver-download branch from c378fa9 to 468e463 Compare July 7, 2026 16:16

@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.

Overall looks good. I added couple of comments / suggestions

Comment thread src/fromager/packagesettings/_resolver.py
Comment thread src/fromager/packagesettings/_resolver.py
Add `_download()` to `AbstractResolver` that dispatches to the
appropriate download helper based on a mandatory `download_kind`
argument.  Each concrete resolver implements a public `download()`
that delegates with its specific `DownloadKind`.

- `PyPIDownloadResolver` accepts `download_kind` as a mandatory
  Pydantic field (restricted to `sdist | tarball`)
- `NotAvailableResolver` and `AbstractHookResolver` override
  `download()` to raise explicitly
- Replace the old `download_kind` ClassVar with a `download_kinds`
  frozenset ClassVar describing which kinds each resolver can return
- Replace `resolves_prebuilt_wheel` property with a ClassVar
- Validate `download_kind` against `download_kinds` in `_download()`

Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Christian Heimes <cheimes@redhat.com>
@tiran tiran force-pushed the resolver-download branch from 468e463 to ed032d1 Compare July 7, 2026 18:04

@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! Thank you

@mergify mergify Bot merged commit 65b163e into python-wheel-build:main Jul 7, 2026
39 checks passed
@mergify

mergify Bot commented Jul 7, 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

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.

2 participants