1{ 2 buildPythonPackage, 3 fetchFromGitHub, 4 lib, 5 pytestCheckHook, 6 pythonOlder, 7 setuptools, 8 typing-extensions, 9 zstd-c, 10}: 11 12buildPythonPackage rec { 13 pname = "pyzstd"; 14 version = "0.17.0"; 15 pyproject = true; 16 17 src = fetchFromGitHub { 18 owner = "Rogdham"; 19 repo = "pyzstd"; 20 tag = version; 21 hash = "sha256-PICYdB/xu/q2wjbkF2nziZt8z8PmzJ5eM+Yq0rpLfEU="; 22 }; 23 24 postPatch = '' 25 # pyzst specifies setuptools<74 because 74+ drops `distutils.msvc9compiler`, 26 # required for Python 3.9 under Windows 27 substituteInPlace pyproject.toml \ 28 --replace-fail '"setuptools>=64,<74"' '"setuptools"' 29 ''; 30 31 nativeBuildInputs = [ 32 setuptools 33 ]; 34 35 build-system = [ 36 setuptools 37 ]; 38 39 dependencies = lib.optionals (pythonOlder "3.13") [ 40 typing-extensions 41 ]; 42 43 pythonRelaxDeps = [ 44 "typing-extensions" 45 ]; 46 47 buildInputs = [ 48 zstd-c 49 ]; 50 51 pypaBuildFlags = [ 52 "--config-setting=--global-option=--dynamic-link-zstd" 53 ]; 54 55 nativeCheckInputs = [ 56 pytestCheckHook 57 ]; 58 59 pythonImportsCheck = [ 60 "pyzstd" 61 ]; 62 63 meta = { 64 description = "Python bindings to Zstandard (zstd) compression library"; 65 homepage = "https://pyzstd.readthedocs.io"; 66 changelog = "https://github.com/Rogdham/pyzstd/blob/${version}/CHANGELOG.md"; 67 license = lib.licenses.bsd3; 68 maintainers = with lib.maintainers; [ 69 MattSturgeon 70 pitkling 71 PopeRigby 72 ]; 73 }; 74}