Skip to main content

Read RAR file from python -- cffi edition

Project description

Build

unrar2-cffi -- Work with RAR files.

Description

unrar2-cffi is a python extension that exposes unrar library functionality through a zipfile-like interface.

This is a fork/modified version of unrar-cffi that supports modern Python starting from 3.9+

This build also target unrar 6.x instead of unrar 5.x from the original unrar-cffi project.

Difference

This packages has some difference to the original one:

  • Added typing information
  • Added __slots__ to improve performance a bit.
  • Moved all the RarInfo into at-property data
    • Now you can access the raw header data by using file._header
  • Added docstring to most functions.
  • Implement RarFile.printdir()

Features

The package implements the following RarFile functions:

  • namelist()
  • infolist()
  • getinfo()
  • read()
  • open()
  • testrar()
  • rarfile.is_rar_file()

Usage

  1. Install with PIP:

    pip install unrar2-cffi

  2. Use from code:

    from unrar.cffi import rarfile

    rar = rarfile.RarFile('sample.rar')

    assert rar.testrar() == None

    for filename in rar.namelist():
        info = rar.getinfo(filename)
        print("Reading {}, {}, {} bytes ({} bytes compressed)".format(info.filename, info.date_time, info.file_size, info.compress_size))
        data = rar.read(filename)
        print("\t{}...\n".format(data[:100]))

Build

Requirements

Linux/macOS:

  • gcc compiler suite (build-essential packages should be enough)
  • docker (only for buildmanylinux)

Windows:

  • VS2022 Build Tools (PLATFORM_TOOLSET=v143)
  • Visual C++ compiler suite
  • vswhere

Compile and test

  1. ./build.sh init
  2. ./build.sh build
  3. ./build.sh test

If you have docker installed, you can build all the manylinux wheels:

  1. ./build.sh within [manylinux docker image] buildmanylinux
  2. ./build.sh within [manylinux docker image] testmanylinux

By deafult the image quay.io/pypa/manylinux2010_x86_64 will be used. Use $DOCKER_IMAGE and $PLAT variables to customize the build.

Problems

Windows:

  • If you need to retarget solution, apply the 0001-build-retarget-to-vs2022-10.0-v143.patch that will utilize the latest version.

macOS:

  • The macOS version are monkeypatching unrar 6.x makefile to utilize C++11

Project details


Download files

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

Source Distribution

unrar2-cffi-0.3.1.tar.gz (262.7 kB view details)

Uploaded Source

Built Distributions

unrar2_cffi-0.3.1-cp312-cp312-win_amd64.whl (215.4 kB view details)

Uploaded CPython 3.12 Windows x86-64

unrar2_cffi-0.3.1-cp312-cp312-win32.whl (184.2 kB view details)

Uploaded CPython 3.12 Windows x86

unrar2_cffi-0.3.1-cp312-cp312-musllinux_1_1_x86_64.whl (750.5 kB view details)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

unrar2_cffi-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (201.0 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

unrar2_cffi-0.3.1-cp312-cp312-macosx_11_0_arm64.whl (158.9 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

unrar2_cffi-0.3.1-cp312-cp312-macosx_10_9_x86_64.whl (158.9 kB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

unrar2_cffi-0.3.1-cp311-cp311-win_amd64.whl (215.4 kB view details)

Uploaded CPython 3.11 Windows x86-64

unrar2_cffi-0.3.1-cp311-cp311-win32.whl (184.1 kB view details)

Uploaded CPython 3.11 Windows x86

unrar2_cffi-0.3.1-cp311-cp311-musllinux_1_1_x86_64.whl (750.0 kB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

unrar2_cffi-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (200.5 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

unrar2_cffi-0.3.1-cp311-cp311-macosx_11_0_arm64.whl (158.9 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

unrar2_cffi-0.3.1-cp311-cp311-macosx_10_9_x86_64.whl (158.9 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

unrar2_cffi-0.3.1-cp310-cp310-win_amd64.whl (215.4 kB view details)

Uploaded CPython 3.10 Windows x86-64

unrar2_cffi-0.3.1-cp310-cp310-win32.whl (184.1 kB view details)

Uploaded CPython 3.10 Windows x86

unrar2_cffi-0.3.1-cp310-cp310-musllinux_1_1_x86_64.whl (750.0 kB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

unrar2_cffi-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (200.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

unrar2_cffi-0.3.1-cp310-cp310-macosx_11_0_arm64.whl (158.9 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

unrar2_cffi-0.3.1-cp310-cp310-macosx_10_9_x86_64.whl (158.9 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

unrar2_cffi-0.3.1-cp39-cp39-win_amd64.whl (215.4 kB view details)

Uploaded CPython 3.9 Windows x86-64

unrar2_cffi-0.3.1-cp39-cp39-win32.whl (184.1 kB view details)

Uploaded CPython 3.9 Windows x86

unrar2_cffi-0.3.1-cp39-cp39-musllinux_1_1_x86_64.whl (750.0 kB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

unrar2_cffi-0.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (200.5 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

unrar2_cffi-0.3.1-cp39-cp39-macosx_11_0_arm64.whl (158.9 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

unrar2_cffi-0.3.1-cp39-cp39-macosx_10_9_x86_64.whl (158.9 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file unrar2-cffi-0.3.1.tar.gz.

File metadata

  • Download URL: unrar2-cffi-0.3.1.tar.gz
  • Upload date:
  • Size: 262.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for unrar2-cffi-0.3.1.tar.gz
Algorithm Hash digest
SHA256 9b7c468f1796e0b0d4614c17537e9122528c89298e3d8a292681aad21ab9caa7
MD5 a1ae5b2e3f31b8bebdf89701610bed76
BLAKE2b-256 120fef00f3ccf594112eaa768f8c692f74d38950036fa7dbc892da9bf79b3248

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3b4805e5f4fdc935e48e7ab11af0b419dd3e960e6ed91024d06346ad69019803
MD5 0de31f3d85d6f92d099642c29c57d193
BLAKE2b-256 7bf80aa9f1304ee68cf462f22b736eef600b7671c0274d0a102f120da618193a

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp312-cp312-win32.whl.

File metadata

  • Download URL: unrar2_cffi-0.3.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 184.2 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for unrar2_cffi-0.3.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 812c4613c0590852ae94e10a1a315860ad182368148b688762453f3b3b70c5fd
MD5 1cbe20feeffeee09f5cbe30d6118460d
BLAKE2b-256 1af0f21623c48fd3f8cb75dc2758257a39977134206c91c982f43424903bd506

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp312-cp312-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 592b0940047441124c36bd5dc94d0f0d7401e077feff2920a9b535576f5d3330
MD5 0fbd588da18aa57307be12f115ba656a
BLAKE2b-256 1db50796dc086b7b683fa01437e21c03616b9e89d9fd72050fd6563d362e9a45

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fc36eac38a462d3b51773ae94db445b3a433cbba6972de57503b296970574717
MD5 52d35aa02f07ca24b42dc50b4a3b43b1
BLAKE2b-256 6be1a2430f458a9bccd2ea564ea0b2efc2e5da71700e0ad01033202172b12241

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 738137e7f8a4c4b660462753f58bfb2efaec42c523814b62207aefae7d097702
MD5 f726ff7dfa3399ec956b34c303caed7b
BLAKE2b-256 427c0b9e09eb9cb2288daead426b14ba9fe222ee9a8a512f5c1f16ed1244950f

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5f11ebaae5d6340c0eee9b463fae6663d14d924191208d5d8eb394a0ba808a42
MD5 0ae204068112d32e5d309d7800583614
BLAKE2b-256 3b27755ec498bf5b0281e325a3663a66daefc2f9ab5570d27684a47b67bbaf5f

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6a096ed3ca865814035ba70659c704ac0eff7da7f9da0e86e4c4c64da2fa7538
MD5 d426d180d7dcb07588dc643dff7266fe
BLAKE2b-256 86bc48a4012d05ed245f94d133f43cae814af889aa8cfe3365ac586c3ef2da0f

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp311-cp311-win32.whl.

File metadata

  • Download URL: unrar2_cffi-0.3.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 184.1 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for unrar2_cffi-0.3.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 d9a02fa1a7fbb64aa1577b4acf7be8843bf6c515925bd8a5a1e9f4112b078b07
MD5 4d75c8f62b648c34a0d2a92dc1c09fab
BLAKE2b-256 b9f5d5b3f83acf17951e12d0abb6c677014d7f3cee6d1c52b2b6e35c6b26e00e

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 15230f9f31d98b54aa070a18ff3573cc4c743c26572965fc523e3bf4e2c72391
MD5 c6bb07e1f6e0fb1cce851ba8e3acc707
BLAKE2b-256 297440e4d41eb45828f467c065540621955fd81fb09ceb0dde1e63bb0934545b

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ebb2c5552c825a61e8f35ecf54cc3567bf1bf49a944f1badf820eeb6ef88ac78
MD5 c9f4ba41880f9953241c190675dd3eea
BLAKE2b-256 6886212369c64de2368d3687fd2eedc68b72f6b423018afe37472bf9f7b0ef5d

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2e5c0fe37c668819fc368dd50dc05f0a5770b1b9c08a487c7204a1d76826fbe2
MD5 3e0576efaf1dd1aacb77c1b86b6540b8
BLAKE2b-256 3b4684d9d45bb8e358e808e2fa4f238f3af97b76de88188cd92cf04ba473c224

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2bd307f6b0686c46d8b6be8940148ca83ad4db45a106bcdd080c7db664db7cfd
MD5 55d75dd1dc3b47ea94e30e6aff25cc80
BLAKE2b-256 834aba02f7410d87e0b146997db96550338aa7732eb2643a2d81a0c825dd3f8d

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 624c454821afe2430ee38aa36403ae67b292a04ab8c27d8df1da61e9d74630fa
MD5 80afe278d904d16d12b70f4ca2194b6e
BLAKE2b-256 96074b706d4ec53fd2f87eef2ade100d1c664ebf7c94d4a34104c9705c2cccec

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp310-cp310-win32.whl.

File metadata

  • Download URL: unrar2_cffi-0.3.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 184.1 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for unrar2_cffi-0.3.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 1d28763f9285b6dab6f2a81be7891192162dc0eaef69524abb157c690c6fc452
MD5 0716d116474c529b13d9139495ef7e9b
BLAKE2b-256 3c114c6a3a024397ae3034a9fbbc2cbbe9a4a3d223d65c8671f786127ac4a12c

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 a7030fbef493e7b198cd64073196c3f4ae92ab88d2aa8d86d623f412a7da1184
MD5 454b91dd485097df336996a9357beeab
BLAKE2b-256 65e9d99e038ccbb181bb518bcfc75d02e73d644d8468ec08f3fa3997dae1adae

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 faae728d03e91aa08925b6f6cd899aa646067b298415f4d1e7c8726cad1b09a1
MD5 7499196f2ccb5dd27026193ecae82fe9
BLAKE2b-256 b6e85dafe3214e9e62d1f466e977900bb33c319cd4bc771a89689183e2e69b9b

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d591762ea80be7cd6096555b94a8ac7e2357b8c98fbc450c9f6c57a4cadbe778
MD5 86a95b0befdd44878fb4fa2d92a94b6a
BLAKE2b-256 bed70d298a0d735c6dc914bb03cd26bc72ee7adf88ff351d8ba721d7efd1e492

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 71af729050a2afee8a945532d3adb98e51b317bebd7e34c9c5120fd18fa135a8
MD5 4ac7b54a46e86b37923f8f330e95646d
BLAKE2b-256 b63a56eeea3eaf0d967f24ccabab2232ad85725707e13efd6d1a38a9d15ccf11

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e146a5d8f3b18c9b3370fd3a182f3a93c8f0113a92b57d0126189da475603e74
MD5 1aa0bcb4eac8f3699cd1ddc8cac765fd
BLAKE2b-256 fc926407711bf4fbef1cd1c685d1fa0ee601323667a15966fa9737ab3d861d51

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp39-cp39-win32.whl.

File metadata

  • Download URL: unrar2_cffi-0.3.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 184.1 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for unrar2_cffi-0.3.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 8282849c640611d1712d5adff8908c63a9549242658c31408be1e6e219f8d1c9
MD5 726cec6b02515a350554ab29e05f9d39
BLAKE2b-256 23ffadb61c236fe3d35e21c51e55daf59a6130c642e2d53bb2344c6f5361df42

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 c40a711f16336ace7c1ba26137ffd6ada97a68ae8d8dbb9d560b1db16dd0b943
MD5 0d661a3139beba3ed5a8a4b8d831de30
BLAKE2b-256 44c96974a230f941e6cbbdae0076f95848cfe17a5c4534ba1f61f85ec472c91f

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2593dafa8ca1c8ffc5ca1893aeb4db1bb9a55059f78368aa19375772e7f6d7b6
MD5 ec7b0737022c52ee54fe90aec8d35ea9
BLAKE2b-256 7e081b9858ba8d1b2d69b4a485ef9061f0f58b851853e6169eb5bfa25ff63b4a

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0f4487f47d273a2af3b5daea9c0e57e286e62d6eea2b6b62dfb4e4e5e41894ac
MD5 9e2c456a60be56adff539e6c0686fb32
BLAKE2b-256 8e59dea26c3c4bf2b91695c6aa328aaac50b3568089b4eff98f0134186d5c876

See more details on using hashes here.

Provenance

File details

Details for the file unrar2_cffi-0.3.1-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for unrar2_cffi-0.3.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5e66ea8f3f4414cfa02bb509faf5949f730e780a9a6e983598c3b0e5afed93b8
MD5 4609a3aa47209d148e2d61fa2ff30f0c
BLAKE2b-256 a391596bf79e2a9bfbb712bb657e6f96a30b1e94551d52428f93711a3e67c694

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page