Add format zstdzip to shutil.make_archive

I was looking into Python’s recent new support for ZStandard that was added in 3.14. I wanted to try porting some usage of shutil.make_archive and was surprised that "zstdzip” was not a format argument option.

The zipfile module has ZIP_ZSTANDARD as an option

Was curious if I was missing something, this was an intentional omission, or something that simply hasn’t been requested/implemented.

1 Like

Probably mostly this? I notice that shutil.make_archive doesn’t expose formats for any other zip compression methods either (e.g., there is no bzzip or xzzip or storedzip). My guess is there just hasn’t been much of a community need yet / no one has made the pitch.

Do you know if there’s been any past discussions about adding shutil.make_archive support for any of the other compression methods that zipfile supports? If other compression methods have been turned down in the past, then similar reasons may apply here.

1 Like

Could not have said it better!

Also note that shutil.unpack_archive does support Zstandard-based zip files, but that is transparent as a side-effect of support in zipfile.

3 Likes

I just started playing with Zstandard (very impressed as it is so much faster and compresses better than DEFLATE).

I find make_archive a very nice convenience interface for making a compressed archive, and since "zstdtar” exists, it seemed like a Zip-equivalent could be nice.

Writing a wrapper around zipfile to reimplement make_archive isn’t super hard (especially in the days of LLMs), but I felt given how powerful Zstandard is, exposing it to the one-line wrapper would be nice.