pypa / pypa/setuptools

[FR] Can't build a zip sdist with `python -m build` in addition of the tar.gz

Open
#3,916 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Discussion
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

What's the problem this feature will solve?

I'm trying to have a zip sdist built using python -m build (in addition to the tar.gz)

Describe the solution you'd like

I understand PEP517 requires a tar.gz, but I don't think it prevents from generating both either. So I'd like a way to make it happen.

I can see looking at the logs that I can get both created in the tmp folder using this:

python -m build -xns --config-setting=--build-option=--formats=gztar,zip

As I get that into the log:

creating '/home/lmazuel/git/mypackage/dist/.tmp-kyj314ae/mypackage-4.8.1.zip' and adding 'mypackage-4.8.1' to it

But the code in _build_meta if filtering explicitly targz files to copy over from the tmp folder:
https://github.com/pypa/setuptools/blob/e94cb204693cee145ea531905dd50b02a26c9f0a/setuptools/build_meta.py#L421

Meaning only the tar.gz remains in the end dist folder.

I'm hoping to keep both files

Alternative Solutions

No response

Additional context

I have precedence of shipping zip as sdist for my packages for a few years now, and those packages are quite used, so I'm afraid changing from zip to tar.gz would break come customers, if they do any black manual magic (linux distro packager for instance). Roughly in that spirit :) : https://xkcd.com/1172/

I feel it's the same mindset of https://github.com/pypa/setuptools/issues/1473, though not exactly the same

Code of Conduct
  • I agree to follow the PSF Code of Conduct

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in setuptools/build_meta.py around line 421 and reproduce the behavior with python -m build -xns --config-setting=--build-option=--formats=gztar,zip. Trace how artifacts are selected from the temporary folder; done means the resulting dist folder retains both the tar.gz and zip source distributions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.