This release is a pre-release and may not be stable for production use.
Code: https://rolln.de/knoppo/xtract
Documentation: https://docs.rolln.de/knoppo/xtract/master
Coverage: https://coverage.rolln.de/knoppo/xtract/master
Python library providing an API to unpack/decompress and pack/compress directories and files. It’s a wrapper around the supported archive and compression formats.
Supported Archives:
Archives are always unpacked to a new directory!
rar
application/rar
application/x-rar
zip
application/zip
application/x-zip
tar
no compression (See usage examples below for an example of adding compression)
application/tar
application/x-tar
Supported Compressions:
gz
application/gzip
application/x-gzip
xz
application/xz
application/x-xz
bz2
application/bzip
application/x-bzip
Installation
pip install xtract
See the quickstart documentation for more detailed installation instructions.
Usage Examples
The convenience function xtract can be used to unpack/decompress anything:
>>> from xtract import xtract
>>> xtract('my-directory.tar.gz')
'/home/<user>/my-directory.tar'
Use the all switch to loop until FileTypeNotSupported is raised:
>>> xtract('my-directory.tar.gz', all=True)
'/home/<user>/my-directory'
Compress a file:
>>> from xtract import bz2
>>> bz2('my-file.txt', delete_source=True)
'/home/<user>/my-file.txt.bz2'
Every function returns the destination (if successful) to chain them:
This creates an intermediate .tar file! Use delete_source=True to delete it afterwards.
>>> from xtract import tar, gzip
>>> gzip(
>>> tar('my-directory', ['file1.txt', 'file2.txt']),
>>> delete_source=True
>>> )
'/home/<user>/my-directory.tar.gz'
See the manual for more examples.
License
Copyright (c) 2017 Mathias Stelzer
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Release files for xtract 0.1a3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xtract-0.1a3.tar.gz | 20.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xtract-0.1a3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 34.7 kB
Release files / xtract-0.1a3.tar.gz
| Download URL | xtract-0.1a3.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1baac33be7494a106233e0db9de8d3ccc743635092a9b134641151c71bc322e3
|
|
BLAKE2b-256 checksum How to use checksums |
3575e5f69665d910be47838cb95bd534f7ca1c47faf47dec147533b94433a13d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / xtract-0.1a3-py2.py3-none-any.whl
| Download URL | xtract-0.1a3-py2.py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e085b268480f2123d1f7e25411a13721e987cfa064447afdbe895949cfe2899a
|
|
BLAKE2b-256 checksum How to use checksums |
37742d74c59ae912dc9336d87e2ff16fa09c9d2f8b4abdd11c5c9d6770948add
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |