Skip to main content

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:

  • Loader
  • Entry
  • ContainerFormat
  • Metadata
  • ArchiveIterator
  • WalkResult
  • WalkIterator
  • open(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="..."), or
  • Loader(data=b"...", name="archive.zip")

Invalid combinations raise ValueError:

  • neither path nor data
  • both path and data
  • data without name

Behavior Notes

  • Traversal is forward-only and optimized for streaming.
  • open(path) returns the first matching leaf entry in traversal scope.
  • Entry supports file-like methods: read, seek, tell, readable, seekable.
  • walk and listdir propagate root failures as errors.
  • Recoverable nested traversal issues are emitted as Python warnings.

ContainerFormat and Metadata

  • detect_format(path) returns ContainerFormat or None.
  • ContainerFormat.name provides a human-readable name.
  • ContainerFormat.is_multi_file indicates whether format contains multiple files.
  • Entry.metadata exposes 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 develop fails, 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 path is treated as a virtual path into nested containers.

Metadata

Release files for unretro 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unretro 0.2.0
File Size Uploaded Provenance Actions
unretro-0.2.0.tar.gz 251.4 kB With provenance Details for unretro-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for unretro 0.2.0
File Actions
unretro-0.2.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for unretro-0.2.0-cp39-abi3-win_amd64.whl
unretro-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for unretro-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
unretro-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for unretro-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
unretro-0.2.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for unretro-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
unretro-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for unretro-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 4.5 MB

Release files / unretro-0.2.0.tar.gz

Download URL unretro-0.2.0.tar.gz
Size 251.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0306603d493651125b8e46d5f125127353eae0de33c93fa20f3671879c8ea5bc
BLAKE2b-256 checksum
How to use checksums
7eaf558749785539b62050f7552cdff97358cf4ad8a1cd40111b265a464d5fc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Release files / unretro-0.2.0-cp39-abi3-win_amd64.whl

Download URL unretro-0.2.0-cp39-abi3-win_amd64.whl
Size 846.8 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9757b00c254762f5e69544c7979d2e97c00dd0135d9fca7af54dde79a26e81c4
BLAKE2b-256 checksum
How to use checksums
195ba6fddf65d9db187deb89557b2165ec41efea86efb78116409d2e3e1fc6b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Release files / unretro-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL unretro-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 893.5 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
53a0c079088afdb9b57817dfad586dca97dc69650a4bd91547d1b50fe4ad3c1a
BLAKE2b-256 checksum
How to use checksums
d8a99d548844ad6cf348b1e42ca7c460f1d09aec2a0733bfef5e772941d1dc30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Release files / unretro-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL unretro-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 866.3 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
644e553bf6697a83d4e1bbb0accf4a3eda4e56963acf5c305a0f9c72b42f9a44
BLAKE2b-256 checksum
How to use checksums
7ae399ee28ddaa97f60fd851e8661ba4643b9addd1b3497736af294ce90c8f9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Release files / unretro-0.2.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL unretro-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Size 808.3 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6d08ebd83c23bc1c236772784068c53b4ddfc3b431fd5f5b293ed613661d9fd1
BLAKE2b-256 checksum
How to use checksums
a89aea4a32ab66d75935bb5a1ed35e1f328dce99265ad3c7621b13635a7ffecd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Release files / unretro-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL unretro-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 861.8 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
f93a3f2e5b1a6e2573062b872163fd488832822d1e6dcd94a4aa9d2a7095deed
BLAKE2b-256 checksum
How to use checksums
fe0e0e2c66d5e006343bf3694b46e5c18dcef98014139bfb721ad76d238806e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Security for unretro 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for unretro-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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