Skip to content

feat(resolver): add LocalIndexProvider#1139

Open
tiran wants to merge 1 commit into
python-wheel-build:mainfrom
tiran:feat/local-provider
Open

feat(resolver): add LocalIndexProvider#1139
tiran wants to merge 1 commit into
python-wheel-build:mainfrom
tiran:feat/local-provider

Conversation

@tiran
Copy link
Copy Markdown
Collaborator

@tiran tiran commented May 12, 2026

Pull Request Description

What

LocalIndexProvider resolves packages from Fromager's local cache directories by scanning for wheel and sdist files. It supports flat and nested (PyPI-like) directory layouts. Caching is disabled since os.scandir and parse_sdist/wheel_filename are fast (1-3 microseconds per file).

Why

In the future, fromager.finders' find_sdist() and find_wheel() will use LocalIndexProvider internally.

@tiran tiran requested a review from a team as a code owner May 12, 2026 08:18
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Review Change Stack

Warning

Rate limit exceeded

@tiran has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 36 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 838fcd8a-f0da-440f-96bb-3dadab3ee041

📥 Commits

Reviewing files that changed from the base of the PR and between 52719f9 and 4780850.

📒 Files selected for processing (2)
  • src/fromager/finders.py
  • tests/test_finders.py
📝 Walkthrough

Walkthrough

This PR adds LocalIndexProvider, a new resolver provider class that discovers distribution candidates (wheels and sdists) from a local filesystem path. The provider supports both flat directory layouts and nested per-package structures, can optionally filter by distribution type, validates wheel tags against supported platforms, and returns candidates without resolver caching. The implementation includes comprehensive tests covering initialization, discovery in both modes, filtering behavior, empty-directory cases, and constraint-based version matching.

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 'feat(resolver): add LocalIndexProvider' directly and clearly summarizes the main change—adding a new LocalIndexProvider class.
Description check ✅ Passed The description clearly explains what LocalIndexProvider does, why it's needed, and its relationship to existing code—all aligned with 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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

@mergify mergify Bot added the ci label May 12, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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/resolver.py`:
- Line 981: Fix the typo in the docstring that currently reads "Lookup
distribtions in a local directory" by changing "distribtions" to "distributions"
so the string becomes "Lookup distributions in a local directory"; locate the
triple-quoted docstring in src/fromager/resolver.py that contains the exact
phrase "Lookup distribtions in a local directory" and update it accordingly.
- Around line 1026-1089: The find_candidates method currently calls
os.scandir(path) which raises FileNotFoundError for missing package directories;
wrap the scandir call in a try/except FileNotFoundError and return an empty
iterable (i.e., stop iteration) instead of letting the exception propagate.
Specifically, in find_candidates, surround the os.scandir(path) iteration with a
try/except FileNotFoundError: block (or assign an empty iterator on error),
optionally logging the missing path when DEBUG_RESOLVER is set, and then
return/yield nothing so callers get an empty result rather than a crash.
🪄 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: 716d7663-1dd5-4ddd-b19a-86bf4d6928c4

📥 Commits

Reviewing files that changed from the base of the PR and between 7b10135 and 2839d74.

📒 Files selected for processing (2)
  • src/fromager/resolver.py
  • tests/test_resolver.py

Comment thread src/fromager/resolver.py Outdated
Comment thread src/fromager/resolver.py Outdated
@tiran tiran force-pushed the feat/local-provider branch 3 times, most recently from 4baae1c to 52719f9 Compare May 12, 2026 11:34
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@tests/test_finders.py`:
- Around line 212-217: The test currently calls
wheels_only.find_candidates("example-pkg") and
sdists_only.find_candidates("example-pkg") directly inside all(...) which will
silently pass when the result is empty; change the test to first capture the
candidate lists (e.g., wheels_candidates =
wheels_only.find_candidates("example-pkg") and sdists_candidates =
sdists_only.find_candidates("example-pkg")), assert that each list is non-empty
(assert wheels_candidates and assert sdists_candidates), then perform the
existing assertions using all(...) on those captured lists; this uses the
existing finders.LocalIndexProvider and find_candidates symbols (wheels_only,
sdists_only) so the checks validate discovery actually returned candidates
before verifying their types.
🪄 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: 8326866a-e656-4617-b150-6dffb25dc960

📥 Commits

Reviewing files that changed from the base of the PR and between 2839d74 and 52719f9.

📒 Files selected for processing (2)
  • src/fromager/finders.py
  • tests/test_finders.py

Comment thread tests/test_finders.py
`LocalIndexProvider` resolves packages from Fromager's local cache
directories by scanning for wheel and sdist files. It supports flat
and nested (PyPI-like) directory layouts. Caching is disabled since
`os.scandir` and `parse_sdist/wheel_filename` are fast (1-3
microseconds per file).

In the future, `fromager.finders`' `find_sdist()` and `find_wheel()`
will use `LocalIndexProvider` internally.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Christian Heimes <cheimes@redhat.com>
@tiran tiran force-pushed the feat/local-provider branch from 52719f9 to 4780850 Compare May 12, 2026 13:43
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.

1 participant