From c68dad170f32ae1a4bbb33812d7ae8ab54002623 Mon Sep 17 00:00:00 2001
From: Chris Ostrouchov <chris.ostrouchov@gmail.com>
Date: Mon, 16 Dec 2019 15:25:06 -0500
Subject: [PATCH] python3Packages.aiokafka: init at 0.5.2

---
 .../python-modules/aiokafka/default.nix       | 49 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            |  2 +
 2 files changed, 51 insertions(+)
 create mode 100644 pkgs/development/python-modules/aiokafka/default.nix

diff --git a/pkgs/development/python-modules/aiokafka/default.nix b/pkgs/development/python-modules/aiokafka/default.nix
new file mode 100644
index 00000000000..b31f83dc136
--- /dev/null
+++ b/pkgs/development/python-modules/aiokafka/default.nix
@@ -0,0 +1,49 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, isPy27
+, kafka-python
+, cython
+, zlib
+}:
+
+buildPythonPackage rec {
+  pname = "aiokafka";
+  version = "0.5.2";
+
+  disabled = isPy27;
+
+  src = fetchFromGitHub {
+    owner = "aio-libs";
+    repo = "aiokafka";
+    rev = "v${version}";
+    sha256 = "062kqsq75fi5pbpqf2a8nxm43pxpr6bwplg6bp4nv2a68r850pki";
+  };
+
+  nativeBuildInputs = [
+    cython
+  ];
+
+  buildInputs = [
+    zlib
+  ];
+
+  propagatedBuildInputs = [
+    kafka-python
+  ];
+
+  postPatch = ''
+    substituteInPlace setup.py \
+       --replace "kafka-python==1.4.6" "kafka-python"
+  '';
+
+  # checks require running kafka server
+  doCheck = false;
+
+  meta = with lib; {
+    description = "Kafka integration with asyncio";
+    homepage = https://aiokafka.readthedocs.org;
+    license = licenses.asl20;
+    maintainers = [ maintainers.costrouc ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index aa361904eb3..032fe94d773 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -4338,6 +4338,8 @@ in {
 
   aioeventlet = callPackage ../development/python-modules/aioeventlet { };
 
+  aiokafka = callPackage ../development/python-modules/aiokafka { };
+
   olefile = callPackage ../development/python-modules/olefile { };
 
   requests-mock = callPackage ../development/python-modules/requests-mock { };