3. Use compression.zstd for standard-library Zstandard
In Python 3.14 and later, prefer compression.zstd for basic Zstandard support instead of reaching for a third-party dependency immediately.
That can simplify packaging and deployment when basic compression support is enough and you prefer standard-library availability over a third-party dependency. As with other standard modules, the advantage is mostly consistency and reduced dependency surface.
Note
Python 3.14+
3.1. Don’t do this
1import zstandard
2
3data = zstandard.ZstdCompressor().compress(b'hello world')
3.2. Do this
1from compression import zstd
2
3data = zstd.compress(b'hello world')