Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide compress/uncompress functions on the gzip module #47738

Closed
pythonhacker mannequin opened this issue Aug 1, 2008 · 16 comments
Closed

Provide compress/uncompress functions on the gzip module #47738

pythonhacker mannequin opened this issue Aug 1, 2008 · 16 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@pythonhacker
Copy link
Mannequin

pythonhacker mannequin commented Aug 1, 2008

BPO 3488
Nosy @gpshead, @jcea, @pitrou
Files
  • test_gzip_svn_diff.patch
  • gzip.py.svndiff
  • gzip.rst.svndiff
  • 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 = <Date 2010-08-17.21:13:39.358>
    created_at = <Date 2008-08-01.17:56:55.725>
    labels = ['type-feature', 'library']
    title = 'Provide compress/uncompress functions on the gzip module'
    updated_at = <Date 2010-10-01.13:23:52.285>
    user = 'https://bugs.python.org/pythonhacker'

    bugs.python.org fields:

    activity = <Date 2010-10-01.13:23:52.285>
    actor = 'pythonhacker'
    assignee = 'none'
    closed = True
    closed_date = <Date 2010-08-17.21:13:39.358>
    closer = 'pitrou'
    components = ['Library (Lib)']
    creation = <Date 2008-08-01.17:56:55.725>
    creator = 'pythonhacker'
    dependencies = []
    files = ['11052', '15282', '15283']
    hgrepos = []
    issue_num = 3488
    keywords = ['patch']
    message_count = 16.0
    messages = ['70578', '70594', '70646', '70650', '70657', '70684', '70686', '94382', '94432', '94683', '94693', '95020', '95021', '110680', '114170', '117797']
    nosy_count = 5.0
    nosy_names = ['gregory.p.smith', 'jcea', 'pitrou', 'pythonhacker', 'BreamoreBoy']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue3488'
    versions = ['Python 3.2']

    @pythonhacker
    Copy link
    Mannequin Author

    pythonhacker mannequin commented Aug 1, 2008

    Python has great in-built support for all sorts of text compression
    including bzip, gzip, tarfile and other general purpose modules like
    zlib etc.

    Of these, I have a gripe with gzip - it does not provide a simple
    way of compressing/uncompressing a string like the other modules
    to (namely bzip, zlib) at the module level.

    It is relatively easy to perform gzip de-compression using the
    GzipFile class and StringIO objects, but compression is not
    that straight-forward.

    It would be great for the gzip module to have "compress"
    and "uncompress" functions at the module level without having
    to go through GzipFile every-time.

    I think being able to send gzip compressed strings directly would be
    useful for applications which require to send gzip data over the wire
    without having to write to files and read-back.

    @pythonhacker pythonhacker mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Aug 1, 2008
    @pythonhacker
    Copy link
    Mannequin Author

    pythonhacker mannequin commented Aug 1, 2008

    Uploading a file containing two functions which can be used to provide
    compress/uncompress on gzip.

    This is not a patch to gzip.py, but a stand-alone file. It this looks
    fine, I will make a patch.

    @pitrou
    Copy link
    Member

    pitrou commented Aug 2, 2008

    I think the functionality is useful, although it may be too late to make
    it into 2.6/3.0. Some comments:

    • the functions should have docstrings
    • there should be unit tests
    • style nit: named parameters in function calls (and default values in
      function declarations) shouldn't have spaces around the '=' sign

    @pythonhacker
    Copy link
    Mannequin Author

    pythonhacker mannequin commented Aug 3, 2008

    Thanks. The file I uploaded was not an actual patch but just how the
    functions would appear in the gzip module, to illustrate the code.

    I can make an actual patch to gzip.py with docstrings, unit-tests and
    taking care of your other comments. Do you think this will be in time
    for Python 3.0 ? I can do this right away.

    @pythonhacker
    Copy link
    Mannequin Author

    pythonhacker mannequin commented Aug 3, 2008

    I have uploaded the actual patch file which can be applied against the
    gzip.py module. I did not modify the _test() function since it is
    written for testing file compression. I can modify test_gzip.py if this
    patch is accepted.

    @pythonhacker
    Copy link
    Mannequin Author

    pythonhacker mannequin commented Aug 4, 2008

    Uploading the svn diff.

    @pythonhacker
    Copy link
    Mannequin Author

    pythonhacker mannequin commented Aug 4, 2008

    Added test case in test_gzip.py. Attaching svn diff of the same.

    @pythonhacker
    Copy link
    Mannequin Author

    pythonhacker mannequin commented Oct 23, 2009

    Can we include this for the next release ?

    @gpshead
    Copy link
    Member

    gpshead commented Oct 24, 2009

    Seems simple enough, I don't see why not.

    @pitrou
    Copy link
    Member

    pitrou commented Oct 29, 2009

    The patch lacks a documentation update, though.
    (see Doc/library/gzip.rst)

    @pythonhacker
    Copy link
    Mannequin Author

    pythonhacker mannequin commented Oct 30, 2009

    Ok, I will add this.

    @pythonhacker
    Copy link
    Mannequin Author

    pythonhacker mannequin commented Nov 7, 2009

    Uploading fresh gzip.py SVN diff with a minor change, i.e accepting a
    regular string as argument, aka zlib.compress.

    @pythonhacker
    Copy link
    Mannequin Author

    pythonhacker mannequin commented Nov 7, 2009

    Uploading rst documentation svn diff for module.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jul 18, 2010

    This appears to have slipped under the radar, msg94432 seems to sum it up. Could someone please take this forward.

    @pitrou
    Copy link
    Member

    pitrou commented Aug 17, 2010

    Modified patch committed in r84155 (py3k). Thanks for your contribution!

    @pitrou pitrou closed this as completed Aug 17, 2010
    @pythonhacker
    Copy link
    Mannequin Author

    pythonhacker mannequin commented Oct 1, 2010

    Okay. Verified as working. Thank you!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants