Skip to content

Extend zipfile's compression level support to LZMA #76909

Open

Description

@bbayles
mannequin
BPO 32728
Nosy @bbayles
PRs
  • bpo-32728: Add compresslevel support for zipfile and LZMA #5534
  • 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 = None
    closed_at = None
    created_at = <Date 2018-01-30.16:47:20.585>
    labels = ['3.8', 'type-feature', 'library']
    title = "Extend zipfile's compression level support  to LZMA"
    updated_at = <Date 2018-02-04.19:39:12.281>
    user = 'https://github.com/bbayles'

    bugs.python.org fields:

    activity = <Date 2018-02-04.19:39:12.281>
    actor = 'bbayles'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2018-01-30.16:47:20.585>
    creator = 'bbayles'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32728
    keywords = ['patch']
    message_count = 1.0
    messages = ['311283']
    nosy_count = 1.0
    nosy_names = ['bbayles']
    pr_nums = ['5534']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue32728'
    versions = ['Python 3.8']

    Activity

    1. bbayles commented on Jan 30, 2018

      bbaylesmannequin
      MannequinAuthor

      In [1] (bpo-21417), support for setting an archive (or its files) compression level was added to the zipfile module.

      That currently works for the ZIP_DEFLATED and ZIP_BZIP2 compression methods, but not for ZIP_LZMA. This is because zipfile includes its own implementation of LZMACompressor that hard-codes the default preset's parameters (see also [2]).

      It should be possible to extend compression level settings to ZIP_LZMA by making zipfile.LZMACompressor more flexible, i.e. able to accept an LZMA preset. I think this would involve porting the function that translates presets to options (lzma_lzma_preset, see [3]) and passing in those options to lzma.LZMACompressor .

      [1] https://bugs.python.org/issue21417
      [2] #5385
      [3] https://git.tukaani.org/?p=xz.git;a=blob;f=src/liblzma/lzma/lzma_encoder_presets.c;hb=HEAD

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Jan 30, 2018
    3. transferred this issue fromon Apr 10, 2022
    4. serhiy-storchaka commented on Jan 15, 2024

      @serhiy-storchaka
      Member

      Why not use compresslevel instead of preset?

    5. bbayles commented on Jan 15, 2024

      @bbayles
      ContributorAuthor

      Someone is welcome to adapt the PR to their taste.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.8 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

      Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions