Skip to content

Implement hook-backed source resolver providers #1324

Description

@LalatenduMohanty

Why this is needed

The new source: configuration supports explicit hook-backed profiles:

  source:
    provider: hook-sdist

and:

  source:
    provider: hook-prebuilt

These profiles allow packages with custom resolution logic to opt into the new source configuration while continuing to use the existing get_resolver_provider package
hook.

The resolver models and PackageBuildInfo.source_resolver property are now available, but AbstractHookResolver.resolver_provider() still raises NotImplementedError. Once resolution dispatch from #1292 is enabled, packages using either hook-backed profile will select the new path but fail before their existing resolver hook can run.

This makes the documented hook profiles unusable and leaves the new source configuration incomplete.

This work belongs to the source configuration epic #1254.

Implementation pointers

  • Delegate to the existing get_resolver_provider package override hook.

  • Preserve compatibility with existing hook arguments, including:

    • ctx
    • req
    • include_sdists
    • include_wheels
    • sdist_server_url
    • req_type
    • ignore_platform
  • Let each profile express its intended artifact type:

    • hook-sdist for source artifacts.
    • hook-prebuilt for pre-built wheels.
  • If a package selects a hook-backed profile but does not provide the required hook, raise a clear, actionable error.

  • Do not silently fall back to the default PyPI provider.

  • Preserve the existing behavior for packages that do not configure source:.

  • Coordinate cooldown behavior with New source config cooldown path has gaps compared to legacy resolve_package_cooldown() #1252 so providers are not configured twice.

This issue should focus on creating resolver providers. Artifact downloading is handled separately by #1293.

Tests

Add tests covering:

  • hook-sdist invokes the package’s get_resolver_provider hook.
  • hook-prebuilt invokes the hook with pre-built-wheel intent.
  • req_type and other supported arguments are propagated correctly.
  • Missing hooks produce a clear error.
  • Invalid hook return values are rejected.
  • Exceptions raised by hooks retain useful context.
  • Existing legacy resolver-provider behavior remains unchanged.

Related issues

Activity

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions