diff --git a/pkgs/development/python-modules/pyzstd/default.nix b/pkgs/development/python-modules/pyzstd/default.nix new file mode 100644 index 000000000000..62e77d821d08 --- /dev/null +++ b/pkgs/development/python-modules/pyzstd/default.nix @@ -0,0 +1,62 @@ +{ + buildPythonPackage, + fetchFromGitHub, + lib, + pytestCheckHook, + setuptools, + zstd-c, +}: +buildPythonPackage rec { + pname = "pyzstd"; + version = "0.16.2"; + pyproject = true; + + src = fetchFromGitHub { + owner = "Rogdham"; + repo = "pyzstd"; + tag = version; + hash = "sha256-Az+0m1XUFxExBZK8bcjK54Zt2d5ZlAKRMZRdr7rPcss="; + }; + + postPatch = '' + # pyzst specifies setuptools<74 because 74+ drops `distutils.msvc9compiler`, + # required for Python 3.9 under Windows + substituteInPlace pyproject.toml \ + --replace-fail '"setuptools>=64,<74"' '"setuptools"' + ''; + + nativeBuildInputs = [ + setuptools + ]; + + build-system = [ + setuptools + ]; + + buildInputs = [ + zstd-c + ]; + + pypaBuildFlags = [ + "--config-setting=--global-option=--dynamic-link-zstd" + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + pythonImportsCheck = [ + "pyzstd" + ]; + + meta = { + description = "Python bindings to Zstandard (zstd) compression library"; + homepage = "https://pyzstd.readthedocs.io"; + changelog = "https://github.com/Rogdham/pyzstd/blob/${version}/CHANGELOG.md"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ + MattSturgeon + PopeRigby + ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b98d245a8297..3ab83883e961 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10988,6 +10988,10 @@ self: super: with self; { pyzipper = callPackage ../development/python-modules/pyzipper { }; + pyzstd = callPackage ../development/python-modules/pyzstd { + zstd-c = pkgs.zstd; + }; + plac = callPackage ../development/python-modules/plac { }; plaid-python = callPackage ../development/python-modules/plaid-python { };