diff --git a/pkgs/development/python-modules/pulsar-client/default.nix b/pkgs/development/python-modules/pulsar-client/default.nix index 84407f37b1c3..c840a160b370 100644 --- a/pkgs/development/python-modules/pulsar-client/default.nix +++ b/pkgs/development/python-modules/pulsar-client/default.nix @@ -2,18 +2,40 @@ lib, buildPythonPackage, fetchFromGitHub, - pythonOlder, + + # build + setuptools, cmake, pkg-config, + + # dependencies libpulsar, pybind11, certifi, + + # optional dependencies + fastavro, + grpcio, + prometheus-client, + protobuf, + ratelimit, + + # test + unittestCheckHook, }: +let + functionDependencies = [ + grpcio + prometheus-client + protobuf + ratelimit + ]; +in buildPythonPackage rec { - pname = "pulsar"; + pname = "pulsar-client"; version = "3.6.1"; - format = "setuptools"; + pyproject = true; src = fetchFromGitHub { owner = "apache"; @@ -22,7 +44,9 @@ buildPythonPackage rec { hash = "sha256-KdPLp0BmZnobU4F6tuMj2DY/ya4QHeGcM/eEAivoXNI="; }; - disabled = pythonOlder "3.7"; + build-system = [ + setuptools + ]; nativeBuildInputs = [ cmake @@ -40,18 +64,37 @@ buildPythonPackage rec { cd .. ''; - propagatedBuildInputs = [ certifi ]; + dependencies = [ certifi ]; - # Requires to setup a cluster - doCheck = false; + pythonRemoveDeps = [ + # not avalilable in nixpkgs + "apache-bookkeeper-client" + ]; + + optional-dependencies = { + functions = functionDependencies; + avro = [ fastavro ]; + all = functionDependencies ++ [ fastavro ]; + }; + + nativeCheckInputs = [ + unittestCheckHook + ] ++ lib.flatten (lib.attrValues (lib.filterAttrs (n: v: n != "all") optional-dependencies)); + + unittestFlagsArray = [ + "-s" + "test" + ]; pythonImportsCheck = [ "pulsar" ]; - meta = with lib; { + __darwinAllowLocalNetworking = true; + + meta = { description = "Apache Pulsar Python client library"; homepage = "https://pulsar.apache.org/docs/next/client-libraries-python/"; changelog = "https://github.com/apache/pulsar-client-python/releases/tag/${src.tag}"; - license = licenses.asl20; - maintainers = with maintainers; [ gaelreyrol ]; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ gaelreyrol ]; }; }