Skip to content

build_sdist plugin hooks can't be used with source: #1445

Open

Description

@LalatenduMohanty

When a package uses source:, Fromager skips its custom build_sdist plugin hook and logs a warning. This also happens with provider: hook-sdist. Packages without source: still use the hook.

This prevents some packages from moving to source:. Their hooks do work that the available pep517 and tarball methods cannot replace, such as:

  • Including the whole repository while the wheel builds from a subdirectory.
  • Choosing a build directory based on the version.
  • Generating files before creating the source archive.

Steps to reproduce

This can be reproduced at the sdist build stage without downloading or compiling a package:

  1. Create a prepared source tree:

    pkg-1.0/
    ├── native.c
    └── python/
        └── setup.py
    
  2. Set build_dir: python.

  3. Provide a build_sdist plugin hook that archives the whole source tree, including native.c.

  4. Call sources.build_sdist() without source: settings. The hook runs, and the archive includes native.c.

  5. Repeat with these settings:

    build_dir: python
    source:
      provider: pypi-sdist

    pypi-sdist uses the tarball build method.

Actual result

Fromager skips the hook and archives only python/. The resulting sdist is missing native.c, but passes Fromager's output validation.

The same problem occurs with hook-sdist configured with build_sdist: tarball. A focused unit test confirms both cases, with the legacy path as a comparison.

A successful wheel build may hide the missing file because Fromager builds the wheel from the prepared source tree rather than from the new sdist.

Expected behavior

Provide an explicit way to use a custom build_sdist hook with source:. Keep the current precedence when users select pep517 or tarball.

Also document this limitation in the build_sdist hook reference.

This is a migration gap introduced by #1385. Existing packages that keep their legacy settings continue to use their hooks.

Activity

  1. added 4 commits that reference this issue on Nov 5, 2026
    1a62292
    b57c173
    0dfeaa3
    3407cdc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions