Skip to content

build_sdist uses tarball instead of PEP 517 #1206

Closed

Description

@smoparth

Context

sources.build_sdist() decides between PEP 517 and tarball based solely on req.url. When req.url is None (as it is for new-source git clones), the function falls to the tarball path. But a raw git checkout lacks proper sdist metadata, and packages using setuptools-scm will produce broken sdists with version 0.0.0.

Each resolver model in _resolver.py already declares a build_sdist field (BuildSDist.pep517 or BuildSDist.tarball) that is not yet consulted by the runtime.

Parent epic: #1254 (Phase 4)
Depends on: Phase 3 (download dispatch — #1293)

Fix

build_sdist() should check pbi.source_resolver.build_sdist when the new config is active:

source = pbi.source_resolver
if source is not None and source.build_sdist == BuildSDist.pep517:
    sdist_file = pep517_build_sdist(...)
elif source is not None and source.build_sdist is None:
    # prebuilt wheel — skip sdist build
    pass
else:
    # Legacy path or tarball
    sdist_file = overrides.find_and_invoke("build_sdist", default_build_sdist, ...)

Related

Metadata

Metadata

Assignees

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