Catalog PyPI
PACKAGE EXPLORERView in registry

7z.py

PyPI

Python ctypes interface for 7z.dll (7-Zip archive library)

7z7ziparchivecompressionctypes
Versions collected1
Direct dependencies5From release 1.0.4
Last observed20 Oct, 16:11 UTC

README

Version 1.0.4 documentation

7z.py

PyPI - Version PyPI - Python Version PyPI - License Tests

Python ctypes interface for 7z.dll (the 7-Zip archive library).Supports reading, extracting, and creating 7z archives with optional password protection and real-time progress callbacks - all via the native 7-Zip COM interface, no subprocess required.

Windows only - requires a 7z.dll for the matching architecture. Bundles 7z.dll for x64, x86, and ARM64.


Installation

uv add 7z.py

or

pip install 7z.py

Python 3.12+ and Windows are required.


Quick start

List entries

from py7z import ArchiveReader

with ArchiveReader("archive.7z") as reader:
    for entry in reader.list_entries():
        print(entry.path, entry.size)

Extract all

from pathlib import Path
from py7z import ArchiveReader

with ArchiveReader("archive.7z") as reader:
    reader.extract_all(output_dir=Path("out/"))

Create an archive

from pathlib import Path
from py7z import ArchiveWriter, ArchiveEntryInput

entries = [ArchiveEntryInput.from_path(p) for p in Path("src/").rglob("*")]

with ArchiveWriter("archive.7z") as writer:
    writer.write(entries)

Progress callbacks

from py7z import ArchiveWriter, ArchiveEntryInput, ProgressInfo

def on_progress(info: ProgressInfo) -> None:
    print(info.summary)

entries = [ArchiveEntryInput.from_path(p) for p in Path("src/").rglob("*")]

with ArchiveWriter("archive.7z") as writer:
    writer.write(entries, progress_cb=on_progress)

ProgressInfo.summary produces output like:

 42.3%  9.5 MB/s  elapsed 0:05  rem 0:02  [3/5 files]  'src/foo.py'

Password protection

# Create
with ArchiveWriter("secret.7z", password="hunter2") as writer:
    writer.write(entries)

# Extract
with ArchiveReader("secret.7z", password="hunter2") as reader:
    reader.extract_all(output_dir=Path("out/"))

Platform support

Wheel tagArchitecture
win_amd64x64 (64-bit)
win32x86 (32-bit)
win_arm64ARM64

License

MIT - see LICENSE. Bundles 7z.dll (LGPL-2.1-or-later).


About Modding Forge

7z.py was built for the Python tooling powering Modding Forge - a community dedicated to Skyrim modding. If you enjoy modding or want to connect with other modders, come say hi!

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.422 Jun 20265

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
modding-forge/7z.py

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 16:11 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:f90f93880a69a26c9ceac7b7e3ca95ee0d16ed0dbe2a4f21d7706b4c85aaa296