[reportlab-users] deterministic output?

Robin Becker robin at reportlab.com
Thu Nov 1 04:28:22 EDT 2018


On 01/11/2018 07:31, Andy Robinson wrote:
> It's designed for exactly what you want; we added it so we could write
> regression tests many years ago.
> 
at the request of a debian maintainer we also have added support for environment variable

SOURCE_DATE_EPOCH

representing a unix time (seconds since the epoch) and if set we use that as the integer time stamp.

Another variable of interest is RL_pdfComments (set to 0) to turn off comments produced in pdfdoc.py; there was a time when 
instance information appeared (possibly with address of the instance) so it might be worth testing your sample outputs to see if 
any comments look as though they contain addresses. If python with hash randomization is used it is possible that the object 
ordering might be affected so perhaps one would need to set PYTHONHASHSEED.

Avoid random input :)

> The PDF file structure contains, among other things, the time the
> document was created.  It can also contains hashes and encodings of
> various parts of the content, and tables with byte offsets to other
> structures in the file.   So, if you run the same 'hello world' script
> twice, you can end up with significant differences between the files.
>    In 'invariant' mode we turn these things off and use a dummy
> constant timestamp, so the same script should produce identical files.
> 
> - Andy
> 
........
-- 
Robin Becker


More information about the reportlab-users mailing list