Skip to content

AbstractResolver does not enforce build_sdist #1256

Description

@smoparth

Description
build_sdist is not defined on AbstractResolver. HookSDistResolver and HookPrebuiltResolver don't define it either. Accessing resolver.build_sdist on these classes raises AttributeError. Any future subclass that forgets to add it will have the same problem.

Problem
When downstream code accesses resolver.build_sdist on a hook resolver, it will raise AttributeError.

Fix

  1. For HookPrebuiltResolver: add build_sdist = None. Pre-built wheels don't need an sdist build step. This is a fixed value, not user-configurable.
  2. HookSDistResolver: add build_sdist = BuildSDist.pep517 as a user-configurable instance field with a default. The hook can return an sdist, a tarball, or a git checkout, the user who writes the hook knows what it returns, so they should specify the build method in YAML.

Example:

source:
  provider: hook-sdist
  build_sdist: tarball    # or pep517 (default)

Metadata

Metadata

Assignees

No one assigned

    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