Skip to content

Build wheels from the generated downstream sdist #1311

Open

Description

@LalatenduMohanty

Problem

Fromager currently creates the downstream sdist and then builds the wheel from the original mutable source tree. Sdist creation may modify that tree, for example by generating PKG-INFO, so the wheel is not actually built from the downstream sdist that is recorded or published.

Proposed change

Use the downstream sdist as the canonical input for the wheel build:

prepare source → create downstream sdist → unpack exact sdist → build wheel

The wheel build should consume the verified downstream sdist. Add tests confirming that generated files and sdist file selection are preserved during the wheel build.

Activity

  1. LalatenduMohanty commented on Sep 1, 2026

    @LalatenduMohanty
    MemberAuthor

    This happens on every build — the issue is architectural.

    The wheel is always built from the original mutable source tree, never from the downstream sdist. In _build.py, _build_wheel() calls _build_sdist() first, then passes the same wi.sdist_root_dir to wheels.build_wheel(). The sdist artifact is never unpacked and fed into the wheel build.

    The source tree is also always modified during sdist creation — ensure_pkg_info() writes a stub PKG-INFO if one doesn't exist, and pep517_build_sdist() can trigger additional backend-specific changes (e.g., *.egg-info). So the divergence between the published sdist and the wheel's actual input is guaranteed on every build, though the severity varies by package and build backend.

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