[Numpy-discussion] savetxt -> gzip: nondeterministic because of time stamp

Andrew Nelson andyfaff at gmail.com
Wed Apr 14 18:15:25 EDT 2021


On Thu, 15 Apr 2021 at 07:15, Robert Kern <robert.kern at gmail.com> wrote:

> On Wed, Apr 14, 2021 at 4:37 PM Joachim Wuttke <j.wuttke at fz-juelich.de>
> wrote:
>
>> Regarding numpy, I'd propose a bolder measure:
>> To let savetxt(fname, X, ...) store exactly the same information in
>> compressed and uncompressed files, always invoke gzip with mtime = 0.
>>
>
> I agree.
>

I might look into making a PR for this. To be clear what would the desired
functionality be:

1. Mandatory to have mtime = 0?

2. Default mtime = 0, but `np.save*` has an extra `mtime` kwd that allows
to set the mtime?

3. Default mtime = time.time(), but `np.save*` has an extra `mtime` kwd
that allows to set the mtime = 0?


As Joachim says for testing/git-related purposes it is nice to have
bit-wise unchanged files produced (such that the file-hash is unchanged),
but I can also see that it might be nice to have a modification time when
files contained in a zip file were last changed (e.g. write with numpy,
check/inspect with a different module). Of course with the latter you could
just look at the overall file-write date, they should be the same.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/numpy-discussion/attachments/20210415/fd398aeb/attachment-0001.html>


More information about the NumPy-Discussion mailing list