Skip to main content

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.

Metadata

Release files for setuptools-reproducible 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for setuptools-reproducible 0.1
File Size Uploaded
setuptools_reproducible-0.1.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for setuptools-reproducible 0.1
File Interpreter ABI Platform
setuptools_reproducible-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / setuptools_reproducible-0.1.tar.gz

Download URL setuptools_reproducible-0.1.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1ae3c0dcca3f125e0fdfb7ce749c872f63d9fe6a0fd8b36954f639ee677f2f73
BLAKE2b-256 checksum
How to use checksums
7bb6de696b39a53e7f05ba62f9f0a1329769679f3bac203d5cb0a90406b1d5a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / setuptools_reproducible-0.1-py3-none-any.whl

Download URL setuptools_reproducible-0.1-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
753dfa85af4fdbcc6dda769403287848b6b982502d1197df681a1fb506a20e5b
BLAKE2b-256 checksum
How to use checksums
e54ebba85bc26060b1b02003a4e6664929792790f9579f56d3b6aeff80bea1d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page