hatch icon indicating copy to clipboard operation
hatch copied to clipboard

hatch not using zstandard for python-3.14.0b3, for free-threading compatibility

Open stonebig opened this issue 8 months ago • 0 comments

would it be possible to not use zstandard on python-3.14, but instead the standard library ? to better enjoy the non-experimental nature of free-threading.

Copilote seems to allucinate that it might not be a problem:

elif self.source.endswith(('.tar.zst', '.tar.zstd')):
    import tarfile
    if sys.version_info[:2] >= (3, 14):
        from compression import zstd
        import io
        with open(archive, "rb") as ifh:
            dctx = zstd.ZstdDecompressor()
            decompressed = dctx.readall(ifh)
            with tarfile.open(fileobj=io.BytesIO(decompressed), mode="r:") as tf:
                if sys.version_info[:2] >= (3, 12):
                    tf.extractall(directory, filter="data")
                else:
                    tf.extractall(directory)  # noqa: S202
    else:
        import zstandard
        with open(archive, "rb") as ifh:
            dctx = zstandard.ZstdDecompressor()
            with dctx.stream_reader(ifh) as reader, tarfile.open(mode="r|", fileobj=reader) as tf:
                if sys.version_info[:2] >= (3, 12):
                    tf.extractall(directory, filter="data")
                else:
                    tf.extractall(directory)  # noqa: S202

stonebig avatar Jun 20 '25 08:06 stonebig