{"id":24777,"library":"tzst","title":"tzst","description":"A Python library for creating and extracting TAR archives with Zstandard (zstd) compression. It provides a high-level API similar to Python's built-in tarfile but with superior compression ratios and performance. Current version 1.3.3, requires Python >=3.12.","status":"active","version":"1.3.3","language":"python","source_language":"en","source_url":"https://github.com/xixu-me/tzst","tags":["archive","compression","zstd","tar"],"install":[{"cmd":"pip install tzst","lang":"bash","label":"install from PyPI"}],"dependencies":[{"reason":"Python bindings to Zstandard compression library.","package":"zstandard","optional":false}],"imports":[{"note":"The open function is the main entry point for reading/writing tzst archives.","wrong":"","symbol":"open","correct":"from tzst import open"},{"note":"TarInfo is re-exported from tzst, but using tarfile's TarInfo may cause type mismatches.","wrong":"from tarfile import TarInfo","symbol":"TarInfo","correct":"from tzst import TarInfo"}],"quickstart":{"code":"from tzst import open\nimport os\n\n# Create a tzst archive\nwith open('example.tar.zst', 'w') as tf:\n    tf.add('file1.txt')\n    tf.add('directory/')\n\n# Extract a tzst archive\nwith open('example.tar.zst', 'r') as tf:\n    tf.extractall(path='./extracted')\n\n# Compress existing tar file\nimport tarfile\nwith tarfile.open('example.tar', 'w') as tar:\n    tar.add('file1.txt')\n# then compress with zstd? Actually tzst handles it directly\n# For reading stream\nwith open('example.tar.zst', 'r') as tf:\n    for member in tf:\n        print(member.name)","lang":"python","description":"Basic usage: open a tzst archive with open() context manager, add files, extract all."},"warnings":[{"fix":"Upgrade Python to 3.12 or later.","message":"tzst requires Python >=3.12. Older Python versions will raise ImportError.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Always use from tzst import open.","message":"The open() function has a different signature from zstandard or tarfile. Do not use zstandard's open() as it produces raw zstd streams, not tzst archives.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade to latest: pip install --upgrade tzst","cause":"Older version of tzst may not have open; or tzst not installed.","error":"ImportError: cannot import name 'open' from 'tzst'"},{"fix":"Use compression_level parameter: open('archive.tar.zst', 'w', compression_level=5)","cause":"The open() function uses 'compression_level' not 'level'.","error":"TypeError: open() got an unexpected keyword argument 'level'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}