Planet Python
Follow
Brett Cannon: What's missing to have reproducible builds on PyPI
The author highlights the lack of a defined method for reproducible builds in Python packaging. Reproducible builds are crucial for supply chain security, allowing third parties to verify that distribution contents match the source code. This process can detect tampering during the build and identify the use of compromised tools. Even pure Python wheels are vulnerable if their build backends are compromised.To achieve reproducible builds, two key pieces of information are needed: the source code location and the software used in the build process. Currently, source code location is not explicitly recorded in sdists or wheels, though installers sometimes record it. A mechanism to include source location information in distribution metadata is proposed.For recording build software, wheels can utilize Software Bill of Materials (SBOMs), but sdists lack a similar structured format, necessitating a potential new sdist version. The author suggests build backends could record their execution environment, and pip maintainers could assist in logging this information without burdening distribution producers.To make reproducibility visible and beneficial, the idea of trusted verifiers independently reproducing distributions and reporting success to PyPI is proposed. This would allow users to identify verified distributions and benefit from a more secure supply chain. This feature should be presented as an optional perk, not a mandatory requirement, to avoid discouraging users.