Platform independent python bindings for the LZMA compression library.
Impressed by the spectacular compression ratios of the Inno Setup compiler, I wanted to use the great compression algorithm LZMA in my own Python programs. As the LZMA SDK by Igor Pavlov is Open Source, it was no problem writing some Python wrappers for the C library. They currently run fine both on Windows and Linux, so hopefully, I can provide a tool that enables the user to read and create 7-zip compatible archives on Linux (as this is not supported by the original 7-zip).
Here are the compression results of different data files with the zlib, bz2 and pylzma modules:
|SVN export of version 0.1.0||542.720||100%||97.923||18.04%||79.660||14.68%||74.009||13.64%|
|20 JPEG wallpapers||7.178.240||100%||6.989.049||97.36%||7.022.040||97.82%||698.0443||97.24%|
Depending on your input data, the differences between zlib/bz2 and pylzma may be even bigger!
- Compression / decompression of a single block of data
- Compression from a file-like object (must provide a read method)
- Streaming decompression through multiple calls to decompress
- An initial library that supports reading of 7-zip archives (both solid and non-solid)
- Compiles and runs on Windows, Linux and OSX
- Multithreaded compression on Windows
- Built with LZMA SDK 4.65
You can download the binaries and the source code for the wrappers from the Python Package Index.
For building, simply run:
python setup.py build
Afterwards, you will find a file pylzma.pyd in the directory build/lib.win32-<PythonVersion> that can get imported by Python. On linux, the file will be called pylzma.so and can be found in a directory called build/lib.linux-<arch>-<PythonVersion>.
Compilation has been tested with Microsoft Visual Studio 2003, GCC 3 (Linux, Cygwin), GCC 4 (Linux) but should work with any ANSI C compiler. Please let me know if you encounter any problems.
Installation using Python eggs
If you installed the EasyInstall package, you can install the latest version of pylzma using the following command:
Refer to the EasyInstall documentation for further details about installing Python eggs. EasyInstall queries the Python Package Index and automatically fetches the latest release.
To get access to my development repository, head your browser to the following URL: http:/github.com/fancycode/pylzma
You can find a port to FreeBSD on freshports.org.
A MacOS X port is maintained at darwinports.com.
Please bring all issues to my Bugzilla bugtracker.
If you like this software, please give me some feedback!