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

Support for more compression types #2

Open
charlesdaniels opened this issue Dec 9, 2017 · 4 comments
Open

Support for more compression types #2

charlesdaniels opened this issue Dec 9, 2017 · 4 comments
Labels

Comments

@charlesdaniels
Copy link
Owner

charlesdaniels commented Dec 9, 2017

Compression other than bz2 should be supported. We don't need to go overkill, but it's sufficiently easy to compress bytes() in Python that we may as well support some more. I would suggest maybe gzip, lz4, and an option to disable compression entirely (i.e. for input data that is already compressed).

When this feature is implemented, the compatibility level counter should be incremented.

I would make use of function pointers; i.e...

compress_data = None
if compressiontype is "bz2":
    compress_data = bz2.compress
elif compressiontype is "lz4"
    compress_data = ...
...

if compress_data is None:
    # crash the program with an error
    ...

...

compressed_data = compress_data(data, compressionlevel)

Note that we will need at least one wrapper function to "compress" data for the uncompressed type, and we also might need some for any compression functions that don't support compression levels (or don't do so as the second positional argument).

@charlesdaniels charlesdaniels added feature new feature to add medium labels Dec 9, 2017
@jyn514 jyn514 self-assigned this Dec 9, 2017
@jyn514
Copy link
Collaborator

jyn514 commented Dec 9, 2017

Added support for gzip in e37c44f

@jyn514 jyn514 removed their assignment Dec 9, 2017
@charlesdaniels
Copy link
Owner Author

This looks good, with the exception of a few nits I commented on in e37c44f.

@jyn514
Copy link
Collaborator

jyn514 commented Feb 22, 2018

Note: lzma (the compression behind .xz files) is supported natively only in python 3; to use it in python two a user would have to install lzma from backports, which involves compiling c code and is generally a pain.

I'm ok with only supporting lzma for python3 if you are.

Note also that lz4 is available through pip but not natively.

@charlesdaniels
Copy link
Owner Author

charlesdaniels commented Feb 22, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants