Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Commit 357df0c

Browse files
authored
Merge branch 'main' into nanokvm-driver
2 parents a9203f2 + 8ef8ada commit 357df0c

5 files changed

Lines changed: 92 additions & 1 deletion

File tree

packages/jumpstarter/jumpstarter/driver/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
Compression.GZIP,
4949
Compression.XZ,
5050
Compression.BZ2,
51+
Compression.ZSTD,
5152
}
5253
)
5354

packages/jumpstarter/jumpstarter/streams/encoding.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import bz2
22
import lzma
3+
import sys
34
import zlib
45
from dataclasses import dataclass
56
from enum import StrEnum
@@ -8,11 +9,17 @@
89
from anyio import ClosedResourceError, EndOfStream
910
from anyio.abc import AnyByteStream, ObjectStream
1011

12+
if sys.version_info >= (3, 14):
13+
from compression import zstd
14+
else:
15+
from backports import zstd
16+
1117

1218
class Compression(StrEnum):
1319
GZIP = "gzip"
1420
XZ = "xz"
1521
BZ2 = "bz2"
22+
ZSTD = "zstd"
1623

1724

1825
@dataclass(kw_only=True)
@@ -86,3 +93,9 @@ def compress_stream(stream: AnyByteStream, compression: Compression | None) -> A
8693
compressor=bz2.BZ2Compressor(),
8794
decompressor=bz2.BZ2Decompressor(),
8895
)
96+
case Compression.ZSTD:
97+
return CompressedStream(
98+
stream=stream,
99+
compressor=zstd.ZstdCompressor(),
100+
decompressor=zstd.ZstdDecompressor(),
101+
)

packages/jumpstarter/jumpstarter/streams/encoding_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def create_buffer(size):
1414
return StapledObjectStream(tx, rx)
1515

1616

17-
@pytest.mark.parametrize("compression", [None, "gzip", "xz", "bz2"])
17+
@pytest.mark.parametrize("compression", [None, "gzip", "xz", "bz2", "zstd"])
1818
async def test_compress_stream(compression):
1919
stream = compress_stream(create_buffer(128), compression)
2020

packages/jumpstarter/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies = [
2020
"pydantic-settings>=2.9.1",
2121
"rich>=14.0.0",
2222
"tenacity>=8.2.0",
23+
"backports-zstd>=1.1.0 ; python_full_version < '3.14'",
2324
]
2425

2526
[dependency-groups]

0 commit comments

Comments
 (0)