Skip to content

gh-162354: Expose zipfile.ZipFile options in zipapp - #162355

Open
Artoria2e5 wants to merge 1 commit into
python:mainfrom
Artoria2e5:zipapp-compress
Open

Artoria2e5 wants to merge 1 commit into
python:mainfrom
Artoria2e5:zipapp-compress

Conversation

@Artoria2e5

Copy link
Copy Markdown

zipapp only lets you pick store or deflate through the compressed flag. zipfile.ZipFile supports more write options: compression, compresslevel, allowZip64 and strict_timestamps.

This exposes all four on create_archive(), and adds --compression METHOD and -l/--level LEVEL to the command line. -c/--compress still works and still means deflate. Unknown method names raise ZipAppError.

--compress stays a flag instead of taking an optional method, because zipapp -c SOURCE has to keep parsing.

Tests cover method selection, compression level, unknown methods, a pre-1980 timestamp, and the CLI. python -m test test_zipapp passes.

AI assistance was used.

create_archive() gains compression, compresslevel, allowZip64 and
strict_timestamps, and the command line gains --compression and --level.
--compress keeps working and still selects deflate.  Unknown method names
raise ZipAppError.

Co-Authored-By: Skadi "Skadeep" Deepseek <noreply@deepseek.com>
@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Nov 21, 2026
@Artoria2e5

Artoria2e5 commented Nov 21, 2026 •

Copy link
Copy Markdown
Author

Apparantly I only had an uncommitted edit to Lib/zipapp.py, without anything else. Thanks AI I guess. Thing is easier than stimulants!

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #36060214 | 📁 Comparing a9ac98b against main (dc222c8)

  🔍 Preview build  

3 files changed
± library/zipapp.html
± whatsnew/3.16.html
± whatsnew/changelog.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant