Commit d3580ff5 authored by Sarah Clark's avatar Sarah Clark
Browse files

python3Packages.pulsar-client: cleanup

parent 9a519a5b
Loading
Loading
Loading
Loading
+53 −10
Original line number Diff line number Diff line
@@ -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 ];
  };
}