Skip to main content

Patool

Patool is a portable archive file manager for the command line.

Various archive formats can be created, extracted, tested, listed, searched, repacked and compared with patool. The advantage of patool is its simplicity in handling archive files without having to remember a myriad of programs and options.

The archive format is determined by the file(1) program and as a fallback by the archive file extension.

Patool supports 7z (.7z, .cb7), ACE (.ace, .cba), ADF (.adf), ALZIP (.alz), APE (.ape), AR (.a), ARC (.arc), ARJ (.arj), BZIP2 (.bz2), BZIP3 (.bz3), CAB (.cab), CHM (.chm), COMPRESS (.Z), CPIO (.cpio), DEB (.deb), DMS (.dms), FLAC (.flac), FREEARC (.arc), GZIP (.gz), ISO (.iso), LRZIP (.lrz), LZH (.lha, .lzh), LZIP (.lz), LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar, .cbr), RZIP (.rz), SHN (.shn), TAR (.tar, .cbt), UDF (.udf), XZ (.xz), ZIP (.zip, .jar, .cbz), ZOO (.zoo) and ZSTANDARD (.zst) archive formats.

The archive formats TAR, ZIP, BZIP2, LZMA and GZIP are supported natively. When using Python >= 3.14 the ZSTANDARD archive format is also supported natively.

Other formats require archive programs as helper applications to handle those formats (for example xz for XZ (.xz) archives). The installation instructions (see below) list suggested archive programs.

Examples

# Extract several archives with different formats
patool extract archive.zip otherarchive.rar

# Extract archive with password
patool extract --password somepassword archive.rar

# Test archive integrity
patool test --verbose dist.tar.gz

# List files stored in an archive
patool list package.deb

# Create a new archive
patool create --verbose /path/to/myfiles.zip file1.txt dir/

# Create a new archive with password
patool create --verbose --password somepassword /path/to/myfiles.zip file1.txt dir/

# Show differences between two archives
patool diff release1.0.tar.gz release2.0.zip

# Search for text inside archives
patool search "def urlopen" python-3.3.tar.gz

# Repackage an archive in a different format
patool repack linux-2.6.33.tar.gz linux-2.6.33.tar.bz2

Website

See [https://wummel.github.io/patool/] for more info and downloads.

Installation and archive programs

See doc/install.md for detailed install instructions and a list of suggested archive programs.

API

You can use patool functions from other Python applications. Log output uses a Python logging handler named "patool" and is configured to print output to sys.stderr. On errors, PatoolError will be raised. Note that extra options or customization for specific archive programs are not supported.

import patoolib
patoolib.extract_archive("archive.zip", outdir="/tmp")
patoolib.test_archive("dist.tar.gz", verbosity=1)
patoolib.list_archive("package.deb")
patoolib.create_archive("/path/to/myfiles.zip", ("file1.txt", "dir/"))
patoolib.diff_archives("release1.0.tar.gz", "release2.0.zip")
patoolib.search_archive("def urlopen", "python3.3.tar.gz")
patoolib.repack_archive("linux-2.6.33.tar.gz", "linux-2.6.33.tar.bz2")
patoolib.is_archive("package.deb")

See [https://wummel.github.io/patool/] for detailed API documentation.

Test suite

Patool has extensive unit tests to ensure code quality. The tests are run on each code push on different platforms and python versions.

Bash completion

Install the argcomplete python package eg. on Debian/Ubuntu with apt-get install python3-argcomplete, then run eval "$(register-python-argcomplete patool)" in your shell. After that typing patool, a <SPACE> and then <TAB> lists available options and commands.

Development

See doc/development.md.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

patool-4.1.0.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

patool-4.1.0-py2.py3-none-any.whl (102.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file patool-4.1.0.tar.gz.

File metadata

  • Download URL: patool-4.1.0.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for patool-4.1.0.tar.gz
Algorithm Hash digest
SHA256 54c669b2af0f5e46d59a53f02ca4f83d53b3a7a25d50e97778582da7cea65daf
MD5 262d05629fe3eb62fbd72f6721a5408f
BLAKE2b-256 1a3c328a6a4e3da061efbd8d69e6b8d7cd5ee37877f9782c68e5b370f4a10dbf

See more details on using hashes here.

File details

Details for the file patool-4.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: patool-4.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 102.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for patool-4.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 acb7cdc5c5b9138eb9713e021aa5450aa32bf3d5c9e778b51e7b6786407eac46
MD5 012a6a6a687f5d033440b28d38c69b4c
BLAKE2b-256 7bf69a9049cfa3b00073c632a437ba85b7d81c787bdeded80cd3dd295089a20a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

4.1.0 This release

2 files

4.0.7

2 files

4.0.6

2 files

4.0.5

2 files

4.0.4

2 files

4.0.3

2 files

4.0.2

2 files

4.0.1

2 files

4.0.0

2 files

3.1.3

2 files

3.1.2

2 files

3.1.0

2 files

3.0.3

2 files

3.0.2

2 files

3.0.1

2 files

3.0.0

2 files

2.4.0

2 files

2.3.0

2 files

2.2.0

2 files

2.1.1

2 files

2.1.0

2 files

2.0.0

2 files

1.15.0

2 files

1.14.1

2 files

1.14.0

2 files

1.13

2 files

1.12

2 files

1.11

2 files

1.10

2 files

1.9

1 file

1.8

1 file

1.7

1 file

1.6

1.5

1.4

1.3

1.2

1.1

1.0

0.19

0.18

0.17

0.16

0.15

0.14

0.13

0.12

0.11

0.10

0.9

0.8

0.7

0.6

0.5

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page