rarfile
RAR archive reader for Python
What it is and what it does
rarfile is a Python module that reads RAR archive files following the interface style of the standard zipfile library. It handles both RAR3 and RAR5 formats, multi-volume archives, password-protected files, and Unicode filenames. Archive parsing and non-compressed file access are implemented in pure Python, while compressed file extraction delegates to an external tool such as unrar, 7zip, unar, or bsdtar.
The module is designed for developers who need to programmatically work with RAR archives in Python. It requires an external decompression tool to be installed on the system for extracting compressed content, but provides a straightforward API for reading archive metadata and accessing file contents without requiring additional Python dependencies.
Use it for:
- Extract files from RAR archives in a Python application without calling command-line tools directly.
- Read metadata and list contents of multi-volume RAR archives.
- Access password-protected RAR files programmatically with password support.
- Process RAR archives with Unicode filenames across different operating systems.
- Migrate legacy code that works with zip files to also handle RAR format archives.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Reads RAR archive files (RAR3 and RAR5 formats) in pure Python, with support for multi-volume archives, password protection, and Unicode filenames, delegating decompression to external tools like unrar or 7zip.
Yes. rarfile is actively maintained, has no Python dependencies, carries a permissive ISC license, and fills a clear need for RAR archive support in Python. The requirement for an external decompression tool is a known and documented constraint, not a deficiency. Suitable for production use when the external tool dependency is acceptable.
Install
rarfile on PyPI
pip
pip install rarfileuv
uv add rarfilepoetry
poetry add rarfileInstalling rarfile
Before you install
Low install friction with no runtime dependencies. Actively maintained as of 2026-08-13 with recent releases. Requires Python 3.10 or later and an external decompression tool (unrar, 7zip, unar, or bsdtar) to extract compressed files.
License in practice
Licensed under ISC (permissive), allowing commercial and private use with minimal restrictions. No copyleft obligations.
Quickstart
pip install rarfile
import rarfile
with rarfile.RarFile('archive.rar') as rf:
rf.extractall()
An external decompression tool (unrar, 7zip, unar, or bsdtar) must be installed on the system; archive parsing and non-compressed file reading work in pure Python, but compressed files require the external tool.
Verify before relying
- Whether the package's external tool detection is automatic or requires manual configuration.
- Performance characteristics when handling large multi-volume archives.
- Specific Python 3.10+ compatibility details beyond the stated requirement.
Package facts
| License | ISC (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 12 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,033,515/month — #1,980 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: rarfile-4.5-py3-none-any.whl
Keywords: rar, unrar, archive
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
unrarProvides Python access to RAR archive files…
copyleft · top 15,000 on PyPI
pyunpackUnpacks archive files in Python with support…
permissive · top 15,000 on PyPI
libarchive-clibarchive-c provides a Python interface to…
permissive · top 15,000 on PyPI
py7zrpy7zr is a pure-Python library for reading,…
copyleft · top 5,000 on PyPI
unix-arReads and writes AR archive files (Unix static…
permissive · top 5,000 on PyPI
extractcodeExtracts a wide range of archive formats (tar,…
permissive · top 15,000 on PyPI
zipfile-deflate64Enables extraction of Deflate64-compressed ZIP…
permissive · top 5,000 on PyPI
warc3-wetRead and iterate over WARC (Web ARChive) and…
copyleft · top 15,000 on PyPI
arpyArpy reads and extracts files from ar archives…
permissive · top 15,000 on PyPI
warc3-wet-clueweb09Reads and iterates over WARC and WET archive…
copyleft · top 15,000 on PyPI