This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Compression level for zipfile
Type: enhancement Stage: commit review
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Decorater, Sworddragon, alanmcintyre, bbayles, berker.peksag, fberger, gregory.p.smith, jens, jfoo, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2014-05-02 18:00 by Sworddragon, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5385 merged bbayles, 2018-01-28 14:48
Messages (10)
msg217770 - (view) Author: (Sworddragon) Date: 2014-05-02 18:00
This is a fork from this ticket: http://bugs.python.org/issue21404

tarfile has a compression level and seems to get now the missing documentation for it. But there is still a compression level missing for zipfile.
msg245753 - (view) Author: Jens Diemer (jens) Date: 2015-06-24 15:10
btw. hacked work-a-round is:

    zlib.Z_DEFAULT_COMPRESSION = 9
msg272610 - (view) Author: Justin Foo (jfoo) * Date: 2016-08-13 20:07
Would compresslevel be a suitable argument? All the backend compressors accept values from 1 to 9 if I'm not mistaken.
msg272611 - (view) Author: Decorater (Decorater) * Date: 2016-08-13 20:15
Yes, it would make sence or better yet have a arg that is optional that if not set make it = ``9``.
msg272646 - (view) Author: Justin Foo (jfoo) * Date: 2016-08-14 05:28
I thought about that, but:

1. compresslevel=None might make look like no compression was being done at all
2. The current default is not 9 for all backends
msg311237 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-01-30 05:54
New changeset ce237c7d58ba207575cdfb0195a58a6407fbf717 by Gregory P. Smith (Bo Bayles) in branch 'master':
bpo-21417: Add compresslevel= to the zipfile module (GH-5385)
https://github.com/python/cpython/commit/ce237c7d58ba207575cdfb0195a58a6407fbf717
msg312883 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-02-26 08:21
I have a concern about the _compresslevel attribute of ZipInfo. Why is it underscored and not documented?
msg312921 - (view) Author: bbayles (bbayles) * Date: 2018-02-26 12:06
I made a comment about that in the pull request that went unchallenged ([1]), but I'm happy to change it.

[1] https://github.com/python/cpython/pull/5385#pullrequestreview-92055354
msg312961 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-02-26 21:36
keeping the conversation in one place, the code review comment was: "I've prefixed this with an underscore because it's not exposed when reading back. ZipInfo has another "private" attribute, _raw_time"

compresslevel is documented on the public APIs where it appears, I do not believe it needs to be a public attribute within ZipInfo given the above as that is an implementation detail.  If we ever find a good reason to make it public in the future we can add a property.
msg312968 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-02-26 22:50
This makes sense to me. Thank you for explanation.
History
Date User Action Args
2022-04-11 14:58:03adminsetgithub: 65616
2018-02-26 22:50:36serhiy.storchakasetmessages: + msg312968
2018-02-26 21:36:06gregory.p.smithsetmessages: + msg312961
2018-02-26 12:06:37bbaylessetmessages: + msg312921
2018-02-26 08:21:15serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg312883
2018-01-30 06:52:14gregory.p.smithsetstatus: open -> closed
stage: patch review -> commit review
resolution: fixed
versions: + Python 3.7, - Python 3.5
2018-01-30 05:54:10gregory.p.smithsetnosy: + gregory.p.smith
messages: + msg311237
2018-01-28 14:55:49bbaylessetnosy: + bbayles
2018-01-28 14:48:49bbaylessetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request5222
2016-08-14 05:28:27jfoosetmessages: + msg272646
2016-08-13 20:15:08Decoratersetnosy: + Decorater
messages: + msg272611
2016-08-13 20:07:26jfoosetnosy: + jfoo
messages: + msg272610
2015-06-24 15:10:54jenssetmessages: + msg245753
2015-06-24 14:50:02jenssetnosy: + jens
2015-01-23 10:38:41fbergersetnosy: + fberger
2014-10-17 16:54:04berker.peksagsetnosy: + berker.peksag
2014-05-02 18:02:48eric.araujosetnosy: + alanmcintyre
stage: needs patch

versions: + Python 3.5, - Python 3.4
2014-05-02 18:00:24Sworddragonsettype: enhancement
2014-05-02 18:00:16Sworddragoncreate