Python bindings for retro container formats (ZIP, LHA, HFS, StuffIt, etc.)
Project description
unretro (Python bindings)
Python bindings for the unretro Rust library.
The package provides forward-only traversal over retro container formats with a Pythonic API (Loader, open, walk, listdir) backed by the Rust implementation.
Related docs:
Installation
pip install unretro
Supported Interfaces
The package exports:
LoaderEntryContainerFormatMetadataArchiveIteratorWalkResultWalkIteratoropen(path, *, max_depth=32)walk(path, *, max_depth=32, topdown=True)listdir(path)detect_format(path)__version__
Quick Examples
Iterate files in a container
import unretro
for entry in unretro.Loader(path="archive.lha"):
print(f"{entry.path}: {entry.size} bytes")
data = entry.read()
Read from bytes
import unretro
loader = unretro.Loader(data=b"...", name="archive.zip")
for entry in loader:
print(entry.name)
Use file-like Entry
import json
import unretro
for entry in unretro.Loader(path="config.zip"):
if entry.extension == "json":
obj = json.load(entry)
print(obj)
Filter traversal
import unretro
loader = unretro.Loader(path="disk.img")
loader = loader.filter_extension(["mod", "xm"])
loader = loader.filter_path("disk.img/music")
for entry in loader:
print(entry.path)
open, walk, and listdir
import unretro
with unretro.open("archive.zip/readme.txt") as f:
print(f.read())
for dirpath, dirnames, filenames in unretro.walk("archive.zip"):
print(dirpath, dirnames, filenames)
print(unretro.listdir("archive.zip"))
Loader Construction Rules
Loader(...) accepts exactly one source:
Loader(path="..."), orLoader(data=b"...", name="archive.zip")
Invalid combinations raise ValueError:
- neither
pathnordata - both
pathanddata datawithoutname
Behavior Notes
- Traversal is forward-only and optimized for streaming.
open(path)returns the first matching leaf entry in traversal scope.Entrysupports file-like methods:read,seek,tell,readable,seekable.walkandlistdirpropagate root failures as errors.- Recoverable nested traversal issues are emitted as Python warnings.
ContainerFormat and Metadata
detect_format(path)returnsContainerFormatorNone.ContainerFormat.nameprovides a human-readable name.ContainerFormat.is_multi_fileindicates whether format contains multiple files.Entry.metadataexposes optional structured metadata when available.
Local Development
From this directory (crates/unretro-python):
python3 -m venv .venv
source .venv/bin/activate
pip install maturin pytest pytest-timeout
maturin develop --release
pytest tests/ -v
Project metadata and test defaults are defined in pyproject.toml.
Troubleshooting
- If
maturin developfails, confirm Rust toolchain and Python headers are available. - If imports fail after rebuilding, re-activate the virtual environment and reinstall with
maturin develop. - If traversal returns unexpected scope, verify whether
pathis treated as a virtual path into nested containers.
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unretro-0.2.0.tar.gz.
File metadata
- Download URL: unretro-0.2.0.tar.gz
- Upload date:
- Size: 251.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0306603d493651125b8e46d5f125127353eae0de33c93fa20f3671879c8ea5bc
|
|
| MD5 |
6a232b16c4f2df31d0ff7e88e40d19e9
|
|
| BLAKE2b-256 |
7eaf558749785539b62050f7552cdff97358cf4ad8a1cd40111b265a464d5fc0
|
Provenance
The following attestation bundles were made for unretro-0.2.0.tar.gz:
Publisher:
release.yml on rickardp/unretro
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unretro-0.2.0.tar.gz -
Subject digest:
0306603d493651125b8e46d5f125127353eae0de33c93fa20f3671879c8ea5bc - Sigstore transparency entry: 1373107328
- Sigstore integration time:
-
Permalink:
rickardp/unretro@9bae7fbe552d40c0277e9e0ceab6f3a467ef23f4 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/rickardp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9bae7fbe552d40c0277e9e0ceab6f3a467ef23f4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unretro-0.2.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: unretro-0.2.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 846.8 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9757b00c254762f5e69544c7979d2e97c00dd0135d9fca7af54dde79a26e81c4
|
|
| MD5 |
fa05abed959ae3a1824882b9b913b94f
|
|
| BLAKE2b-256 |
195ba6fddf65d9db187deb89557b2165ec41efea86efb78116409d2e3e1fc6b0
|
Provenance
The following attestation bundles were made for unretro-0.2.0-cp39-abi3-win_amd64.whl:
Publisher:
release.yml on rickardp/unretro
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unretro-0.2.0-cp39-abi3-win_amd64.whl -
Subject digest:
9757b00c254762f5e69544c7979d2e97c00dd0135d9fca7af54dde79a26e81c4 - Sigstore transparency entry: 1373107782
- Sigstore integration time:
-
Permalink:
rickardp/unretro@9bae7fbe552d40c0277e9e0ceab6f3a467ef23f4 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/rickardp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9bae7fbe552d40c0277e9e0ceab6f3a467ef23f4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unretro-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: unretro-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 893.5 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53a0c079088afdb9b57817dfad586dca97dc69650a4bd91547d1b50fe4ad3c1a
|
|
| MD5 |
d00fbf6e9458e39199baaaf07bfd1254
|
|
| BLAKE2b-256 |
d8a99d548844ad6cf348b1e42ca7c460f1d09aec2a0733bfef5e772941d1dc30
|
Provenance
The following attestation bundles were made for unretro-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on rickardp/unretro
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unretro-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
53a0c079088afdb9b57817dfad586dca97dc69650a4bd91547d1b50fe4ad3c1a - Sigstore transparency entry: 1373107425
- Sigstore integration time:
-
Permalink:
rickardp/unretro@9bae7fbe552d40c0277e9e0ceab6f3a467ef23f4 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/rickardp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9bae7fbe552d40c0277e9e0ceab6f3a467ef23f4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unretro-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: unretro-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 866.3 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
644e553bf6697a83d4e1bbb0accf4a3eda4e56963acf5c305a0f9c72b42f9a44
|
|
| MD5 |
19b9f075021d64912b511a580eab3f93
|
|
| BLAKE2b-256 |
7ae399ee28ddaa97f60fd851e8661ba4643b9addd1b3497736af294ce90c8f9d
|
Provenance
The following attestation bundles were made for unretro-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on rickardp/unretro
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unretro-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
644e553bf6697a83d4e1bbb0accf4a3eda4e56963acf5c305a0f9c72b42f9a44 - Sigstore transparency entry: 1373107679
- Sigstore integration time:
-
Permalink:
rickardp/unretro@9bae7fbe552d40c0277e9e0ceab6f3a467ef23f4 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/rickardp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9bae7fbe552d40c0277e9e0ceab6f3a467ef23f4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unretro-0.2.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: unretro-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 808.3 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d08ebd83c23bc1c236772784068c53b4ddfc3b431fd5f5b293ed613661d9fd1
|
|
| MD5 |
ee75048a0c98dbbddd33b6fd5bdc0d5b
|
|
| BLAKE2b-256 |
a89aea4a32ab66d75935bb5a1ed35e1f328dce99265ad3c7621b13635a7ffecd
|
Provenance
The following attestation bundles were made for unretro-0.2.0-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on rickardp/unretro
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unretro-0.2.0-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
6d08ebd83c23bc1c236772784068c53b4ddfc3b431fd5f5b293ed613661d9fd1 - Sigstore transparency entry: 1373107597
- Sigstore integration time:
-
Permalink:
rickardp/unretro@9bae7fbe552d40c0277e9e0ceab6f3a467ef23f4 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/rickardp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9bae7fbe552d40c0277e9e0ceab6f3a467ef23f4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unretro-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: unretro-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 861.8 kB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f93a3f2e5b1a6e2573062b872163fd488832822d1e6dcd94a4aa9d2a7095deed
|
|
| MD5 |
14c1832b78bd0b9506b68847d454f6a8
|
|
| BLAKE2b-256 |
fe0e0e2c66d5e006343bf3694b46e5c18dcef98014139bfb721ad76d238806e2
|
Provenance
The following attestation bundles were made for unretro-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on rickardp/unretro
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unretro-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
f93a3f2e5b1a6e2573062b872163fd488832822d1e6dcd94a4aa9d2a7095deed - Sigstore transparency entry: 1373107497
- Sigstore integration time:
-
Permalink:
rickardp/unretro@9bae7fbe552d40c0277e9e0ceab6f3a467ef23f4 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/rickardp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9bae7fbe552d40c0277e9e0ceab6f3a467ef23f4 -
Trigger Event:
push
-
Statement type: