$ show ziglang/zig-pypi
This repository provides a tool for repackaging official Zig programming language releases as Python binary wheels. The core functionality resides in make_wheels.py, which downloads Zig tarballs, verifies their integrity, extracts contents, and rebuilds them as installable Python wheels with appropriate metadata and entry points. The architecture is straightforward: a command-line Python script supported by a GitHub Actions workflow for automated building and deployment. The tool enables Python developers to easily install and use the Zig toolchain (including the zig cc compiler) as a dependency via pip. Key features include reproducible builds (bit-for-bit identical outputs regardless of build environment), support for multiple platforms (Windows, macOS, Linux variants), and automated publishing to PyPI with provenance attestations.
The LLM identified 2 files worth highlighting for reuse:
The ReproducibleWheelFile class ensures bit-for-bit identical wheel outputs by overriding writestr to set deterministic timestamps (1980-01-01), permissions, and other variable fields. This solves the challenging problem of creating reproducible Python builds, which is essential for build verification and supply chain security. The implementation is self-contained, requiring only the wheel package, and could be extracted for use in any Python packaging project needing reproducible outputs.
The iter_archive_contents function provides a clean, unified interface for handling both tar.xz and zip archive formats. It automatically detects the format via magic bytes, normalizes file paths by stripping leading directory components, and yields file metadata and content. This self-contained utility demonstrates solid error handling and format agnosticism, making it reusable in any project needing to process multiple archive types without format-specific branching logic.