Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ dependencies = [
"userpath~=1.7",
"uv>=0.5.23",
"virtualenv>=20.26.6",
"zstandard<1",
"backports.zstd; python_version<'3.14'",
]
dynamic = ["version"]

Expand Down
19 changes: 10 additions & 9 deletions src/hatch/python/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,16 @@ def unpack(self, archive: Path, directory: Path) -> None:
elif self.source.endswith((".tar.zst", ".tar.zstd")):
import tarfile

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
if sys.version_info < (3, 14):
from backports import zstd
else:
from compression import zstd

with zstd.open(archive) 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
else:
message = f"Unknown archive type: {archive}"
raise ValueError(message)
Expand Down