Skip to content

Add helpers to turn git checkout / tar ball into valid sdist #554

Description

@tiran

A Python sdist has a specific naming convention, directory structure, and an additional file. A git checkout or a tar ball from a git commit / GitHub release are not valid Python sdists. We have a few cases where we download a tag or commit directly from GitHub or tar a local git clone. These tar balls work as sdists in some cases but break in other cases.

Suggestion

Add a helper method that turns a directory into a (mostly) valid sdist. Perhaps add a second function that automates unpacking a tar ball and creating a new tar ball.

  • output file name must be {name}-{version}.tar.gz with correct normalization of name and version
  • tar ball must contain a single top-level directory with name {name}-{version}
  • tar ball must contain {name}-{version}/PKG-INFO file with at least Metadata-Version, Name, and Version entries. Metadata version should be 2.2. Later versions require more fields.
  • SPECIAL CASE if the project needs build_dir, then also place a PKG-INFO file in {name}-{version}/{build_dir}/PKG-INFO, so setuptools-scm can find it.
  • perhaps deprecate download_source.destination_filename?
Metadata-Version: 2.2
Name: {req.name}
Version: {version}
Summary: Dummy PKG-INFO from Fromager

References

Metadata

Metadata

Assignees

Labels

Fields

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions