quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.28k stars 1.02k forks source link

Make wheel-building process reproducible #6502

Open pavoljuhas opened 8 months ago

pavoljuhas commented 8 months ago

Description of the issue

Problem

The version string for the pre-release cirq packages at https://pypi.org/project/cirq/#history is generated from the build execution time. As such the version date string can differ by ~30s from the commit time, for example, cirq-1.4.0.dev20240314200117 corresponds to the 2700f959ead6fb7c3bdcbdd96ce936e78a34843c dated

$ TZ=UTC git show -s --pretty=%cd --date=iso-local 2700f959ead6fb7c3bdcbdd96ce936e78a34843c
2024-03-14 20:00:50 +0000

This makes it more tricky to find git commit given a pre-release version. It is also not feasible to re-generate distribution wheels for an older commit.

Solution:

Derive dev-version string from the git commit time. Support wheel building for older commits in addition to the repo HEAD.

Cirq version

1.4.0.dev at 2700f959ead6fb7c3bdcbdd96ce936e78a34843c