You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Documented equivalent of gzip -n (omit timestamp and original file name) in gzip module #82906
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2019-11-06.20:06:31.047>labels= ['library']
title='Documented equivalent of `gzip -n` (omit timestamp and original file name) in gzip module'updated_at=<Date2019-11-06.20:06:31.047>user='https://bugs.python.org/zwol'
Right now, the gzip module lets you set MTIME to zero explicitly by passing mtime=0 to the GzipFile constructor, but this is not documented. You can avoid writing out a filename by opening the output file yourself:
with gzip.GzipFile(fileobj=open("foo.gz", "wb"),
filename='', mtime=0) as ofp:
... write to ofp ...
but that's awkward and, again, not documented. I'd like to be able to write something like this instead:
Activity
zwol commentedon Nov 6, 2019
Recent versions of the gzip command-line utility have an option
-nwhich causes it to omit the FNAME field of the gzip file header, and write out the MTIME field as zero. Both of these properties are desirable when constructing reproducible build artifacts (see https://reproducible-builds.org/ ).Right now, the gzip module lets you set MTIME to zero explicitly by passing
mtime=0to the GzipFile constructor, but this is not documented. You can avoid writing out a filename by opening the output file yourself:but that's awkward and, again, not documented. I'd like to be able to write something like this instead:
with this being the documented way to achieve the same effect as
gzip -n.serhiy-storchaka commentedon May 21, 2026
This was documented in bpo-43848/#88014.