get_source_date_epoch#

technote.metadata.builddate.get_source_date_epoch()#

Read the SOURCE_DATE_EPOCH environment variable as a datetime.

SOURCE_DATE_EPOCH is the reproducible-builds convention for pinning a build’s timestamp; Sphinx honours it as well. Its value is an integer number of seconds since the Unix epoch.

Returns:

The pinned timestamp, in UTC, or None if the variable is unset, does not hold an integer, or holds a value that is out of range for a datetime.

Return type:

datetime.datetime or None