Extension of setuptools to support reproducible dists
Project description
setuptools-reproducible
This is a PEP 517 Build backend enabling reproducible builds with setuptools.
Setuptools can create reproducible wheel archives (.whl) by setting SOURCE_DATE_EPOCH
at build time, but setting the env var is insufficient for creating reproducible sdists (.tar.gz).
setuptools-reproducible wraps the hooks build_sdist
and build_wheel
with some modifications to make reproducible builds by default:
- In the build environment,
SOURCE_DATE_EPOCH=0
will be used if it wasn't already configured. - Tarfile modes are set to 0o644 for regular files and 0o755 for directories.
- The uid/gid of archive members are set to 0, and the username/groupname are set to empty string.
- Gzip header values set to source date epoch.
With these modifications, a source tree with the same content should result in a built package with the same checksum when created within the same build environment.
Note: checksums are not necessarily constant across platform and Python versions, due to differences such Windows/Unix line endings and Python standard library changes.
Usage:
The backend functions identically to upstream setuptools.
The only thing a user needs to change is to specify the build system in pyproject.toml
:
[build-system]
requires = ["setuptools-reproducible"]
build-backend = "setuptools_reproducible"
Setting SOURCE_DATE_EPOCH
is unnecessary, unless you want to override the default value of 0
i.e. 1970-01-01 00:00:00 UTC.
Acknowledgements:
This implementation was inspired by a helpful comment from Lisandro Dalcin in setuptools issue #2133, and also used some ideas from the project repro-tarfile.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for setuptools_reproducible-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ae3c0dcca3f125e0fdfb7ce749c872f63d9fe6a0fd8b36954f639ee677f2f73 |
|
MD5 | afb3d02461c1a9170608b5de4dce2d41 |
|
BLAKE2b-256 | 7bb6de696b39a53e7f05ba62f9f0a1329769679f3bac203d5cb0a90406b1d5a1 |
Hashes for setuptools_reproducible-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 753dfa85af4fdbcc6dda769403287848b6b982502d1197df681a1fb506a20e5b |
|
MD5 | f68286bb239b614d3c25010b0573d761 |
|
BLAKE2b-256 | e54ebba85bc26060b1b02003a4e6664929792790f9579f56d3b6aeff80bea1d2 |