From 0f74ce6cef178c67c6a8aaf33d6bc7ed94721805 Mon Sep 17 00:00:00 2001 From: DESPsyched Date: Wed, 10 Sep 2025 02:36:48 -0400 Subject: [PATCH 1/2] python3Packages.kafka-python: re-init at 2.3.2 --- .../python-modules/kafka-python/default.nix | 84 +++++++++++++++++++ pkgs/top-level/python-aliases.nix | 1 - pkgs/top-level/python-packages.nix | 2 + 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/kafka-python/default.nix diff --git a/pkgs/development/python-modules/kafka-python/default.nix b/pkgs/development/python-modules/kafka-python/default.nix new file mode 100644 index 000000000000..05a90a9f6624 --- /dev/null +++ b/pkgs/development/python-modules/kafka-python/default.nix @@ -0,0 +1,84 @@ +{ + buildPythonPackage, + fetchFromGitHub, + lib, + pythonAtLeast, + + # build system + setuptools, + + # optional dependencies + crc32c, + lz4, + pyperf, + python-snappy, + zstandard, + + # test dependencies + pytestCheckHook, + pytest-mock, + pytest-timeout, + xxhash, +}: + +buildPythonPackage (finalAttrs: { + pname = "kafka-python"; + version = "2.3.2"; + pyproject = true; + __structuredAttrs = true; + + disabled = pythonAtLeast "3.14"; + + src = fetchFromGitHub { + owner = "dpkp"; + repo = "kafka-python"; + tag = finalAttrs.version; + hash = "sha256-FC5ntcRy2iF2sqYVxWg11EcGA5ncpuUuQHOkBG0paog="; + }; + + build-system = [ setuptools ]; + + optional-dependencies = { + benchmarks = [ pyperf ]; + crc32c = [ crc32c ]; + lz4 = [ lz4 ]; + snappy = [ python-snappy ]; + zstd = [ zstandard ]; + }; + + pythonImportsCheck = [ + "kafka" + "kafka.admin" + "kafka.benchmarks" + "kafka.cli" + "kafka.consumer" + "kafka.coordinator" + "kafka.metrics" + "kafka.partitioner" + "kafka.producer" + "kafka.protocol" + "kafka.record" + "kafka.sasl" + "kafka.serializer" + "kafka.vendor" + ]; + + nativeCheckInputs = [ + pytest-mock + pytest-timeout + pytestCheckHook + xxhash + ] + ++ lib.concatAttrValues finalAttrs.passthru.optional-dependencies; + + meta = { + changelog = "https://github.com/dpkp/kafka-python/blob/${finalAttrs.src.tag}/CHANGES.md"; + description = "Pure Python client for Apache Kafka"; + homepage = "https://github.com/dpkp/kafka-python"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ + de11n + despsyched + ]; + }; +}) diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index a7d277f88617..0c96df507180 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -298,7 +298,6 @@ mapAliases { jupyter_core = throw "'jupyter_core' has been renamed to/replaced by 'jupyter-core'"; # Converted to throw 2025-10-29 jupyter_server = throw "'jupyter_server' has been renamed to/replaced by 'jupyter-server'"; # Converted to throw 2025-10-29 jupyterlab_server = throw "'jupyterlab_server' has been renamed to/replaced by 'jupyterlab-server'"; # Converted to throw 2025-10-29 - kafka-python = throw "'kafka-python' has been renamed to/replaced by 'kafka-python-ng'"; # Converted to throw 2025-10-29 Kajiki = throw "'Kajiki' has been renamed to/replaced by 'kajiki'"; # Converted to throw 2025-10-29 keepkey-agent = throw "keepkey-agent has been removed because upstream dropped KeepKey support"; # Added 2026-03-11 keepkey_agent = throw "keepkey-agent has been removed because upstream dropped KeepKey support"; # Added 2026-03-11 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 59128805b25d..5079ef7a101e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8342,6 +8342,8 @@ self: super: with self; { kaa-metadata = callPackage ../development/python-modules/kaa-metadata { }; + kafka-python = callPackage ../development/python-modules/kafka-python { }; + kafka-python-ng = callPackage ../development/python-modules/kafka-python-ng { }; kaggle = callPackage ../development/python-modules/kaggle { }; From 156b8dbaac8ca57b5d42d435993407fbc260441f Mon Sep 17 00:00:00 2001 From: DESPsyched Date: Fri, 12 Jun 2026 03:38:10 -0400 Subject: [PATCH 2/2] python3Packages.pytest-kafka: depend on kafka-python --- .../python-modules/pytest-kafka/default.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/pytest-kafka/default.nix b/pkgs/development/python-modules/pytest-kafka/default.nix index 1da9b7d6b6dd..af77b53c8186 100644 --- a/pkgs/development/python-modules/pytest-kafka/default.nix +++ b/pkgs/development/python-modules/pytest-kafka/default.nix @@ -1,9 +1,13 @@ { - lib, buildPythonPackage, fetchFromGitLab, + lib, + + # build system setuptools, - kafka-python-ng, + + # dependencies + kafka-python, port-for, pytest, }: @@ -23,7 +27,7 @@ buildPythonPackage rec { build-system = [ setuptools ]; dependencies = [ - kafka-python-ng + kafka-python port-for pytest ];