From 9a519a5b5b7552ecd55a956b3232bbc047a5a279 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Wed, 28 May 2025 13:00:07 -0700 Subject: [PATCH 1/3] python3Packages.pulsar-client: remove duplicate derivation Copy `python3Packages.pulsar`'s `default.nix` to `python3Packages.pulsar-client`, then remove `python3Packages.pulsar` and apply alias. --- .../python-modules/pulsar-client/default.nix | 164 +++++------------- .../python-modules/pulsar/default.nix | 57 ------ pkgs/top-level/python-packages.nix | 2 - 3 files changed, 44 insertions(+), 179 deletions(-) delete mode 100644 pkgs/development/python-modules/pulsar/default.nix diff --git a/pkgs/development/python-modules/pulsar-client/default.nix b/pkgs/development/python-modules/pulsar-client/default.nix index 2c236dca67fd..84407f37b1c3 100644 --- a/pkgs/development/python-modules/pulsar-client/default.nix +++ b/pkgs/development/python-modules/pulsar-client/default.nix @@ -1,133 +1,57 @@ { lib, - stdenv, buildPythonPackage, - fetchPypi, - python, + fetchFromGitHub, + pythonOlder, + cmake, + pkg-config, + libpulsar, + pybind11, + certifi, }: -let - version = "3.4.0"; - inherit (python) pythonVersion; +buildPythonPackage rec { + pname = "pulsar"; + version = "3.6.1"; + format = "setuptools"; - Srcs = - let - getSrcFromPypi = - { - platform, - dist, - hash, - }: - fetchPypi { - inherit - version - platform - dist - hash - ; - pname = "pulsar_client"; - format = "wheel"; - python = dist; - abi = dist; - }; - in - { - "3.9-x86_64-linux" = getSrcFromPypi { - platform = "manylinux_2_17_x86_64.manylinux2014_x86_64"; - dist = "cp39"; - hash = "sha256-1P5ArMoLZiUkHUoQ/mJccbNj5/7el/op+Qo6cGQ33xE="; - }; - "3.9-aarch64-linux" = getSrcFromPypi { - platform = "manylinux_2_17_aarch64.manylinux2014_aarch64"; - dist = "cp39"; - hash = "sha256-11JQZRwMLtt7sK/JlCBqqRyfTVIAVJFN2sL+nAkQgvU="; - }; - "3.9-aarch64-darwin" = getSrcFromPypi { - platform = "macosx_10_15_universal2"; - dist = "cp39"; - hash = "sha256-dwTGZKosgBr0wtOljp2P+u7xLOig9xcS6Rh/mpbahW8="; - }; - "3.9-x86_64-darwin" = getSrcFromPypi { - platform = "macosx_10_15_universal2"; - dist = "cp39"; - hash = "sha256-dwTGZKosgBr0wtOljp2P+u7xLOig9xcS6Rh/mpbahW8="; - }; - "3.10-x86_64-linux" = getSrcFromPypi { - platform = "manylinux_2_17_x86_64.manylinux2014_x86_64"; - dist = "cp310"; - hash = "sha256-swp1kuQsdgNOmo1k1C3VurNhQl+GneVi6cytaY4ZzYg="; - }; - "3.10-aarch64-linux" = getSrcFromPypi { - platform = "musllinux_1_1_aarch64"; - dist = "cp310"; - hash = "sha256-1ZYwkKeKVkS6JfQdo6bUnqPwDJcrCVuv82WRbcJGQmo="; - }; - "3.10-aarch64-darwin" = getSrcFromPypi { - platform = "macosx_10_15_universal2"; - dist = "cp310"; - hash = "sha256-6/mdtSRP9pR5KDslYhsHBJKsxLtkPRYthrkDh8tv2yo="; - }; - "3.10-x86_64-darwin" = getSrcFromPypi { - platform = "macosx_10_15_universal2"; - dist = "cp310"; - hash = "sha256-6/mdtSRP9pR5KDslYhsHBJKsxLtkPRYthrkDh8tv2yo="; - }; - "3.11-x86_64-linux" = getSrcFromPypi { - platform = "manylinux_2_17_x86_64.manylinux2014_x86_64"; - dist = "cp311"; - hash = "sha256-M1cd6ZzYmDSfF5eLpi4rg56gJ1+3Bn8xv19uv+rgmH0="; - }; - "3.11-aarch64-linux" = getSrcFromPypi { - platform = "manylinux_2_17_aarch64.manylinux2014_aarch64"; - dist = "cp311"; - hash = "sha256-+HQ8MgqpZ5jSDK+pjql6aMQpX8SHLCOs1eAS/TbLBro="; - }; - "3.11-aarch64-darwin" = getSrcFromPypi { - platform = "macosx_10_15_universal2"; - dist = "cp311"; - hash = "sha256-EZUvsCLuct6/U7Fp9EgvncXIkL4BSa6Yd5hks6IfG9M="; - }; - "3.11-x86_64-darwin" = getSrcFromPypi { - platform = "macosx_10_15_universal2"; - dist = "cp311"; - hash = "sha256-EZUvsCLuct6/U7Fp9EgvncXIkL4BSa6Yd5hks6IfG9M="; - }; - "3.12-x86_64-linux" = getSrcFromPypi { - platform = "manylinux_2_17_x86_64.manylinux2014_x86_64"; - dist = "cp312"; - hash = "sha256-xgbATzVzQQQvpsdUd959IgT3rlCqKcL3SyTlTIX0f5Y="; - }; - "3.12-aarch64-linux" = getSrcFromPypi { - platform = "manylinux_2_17_aarch64.manylinux2014_aarch64"; - dist = "cp312"; - hash = "sha256-8gK4Th9oPWRnLdGXERRgCuLlw3NVhyhv+b+0MThfCOg="; - }; - "3.12-aarch64-darwin" = getSrcFromPypi { - platform = "macosx_10_15_universal2"; - dist = "cp312"; - hash = "sha256-Hgd6SDm+Pq094/BbTCRCadyi3wf0fOoLkFRMfp3BZC8="; - }; - "3.12-x86_64-darwin" = getSrcFromPypi { - platform = "macosx_10_15_universal2"; - dist = "cp312"; - hash = "sha256-Hgd6SDm+Pq094/BbTCRCadyi3wf0fOoLkFRMfp3BZC8="; - }; - }; -in -buildPythonPackage { - pname = "pulsar-client"; - inherit version; + src = fetchFromGitHub { + owner = "apache"; + repo = "pulsar-client-python"; + tag = "v${version}"; + hash = "sha256-KdPLp0BmZnobU4F6tuMj2DY/ya4QHeGcM/eEAivoXNI="; + }; - format = "wheel"; + disabled = pythonOlder "3.7"; - src = - Srcs."${pythonVersion}-${stdenv.hostPlatform.system}" - or (throw "Unsupported '${pythonVersion}-${stdenv.hostPlatform.system}' target"); + nativeBuildInputs = [ + cmake + pkg-config + ]; + + buildInputs = [ + libpulsar + pybind11 + ]; + + preBuild = '' + make -j$NIX_BUILD_CORES + make install + cd .. + ''; + + propagatedBuildInputs = [ certifi ]; + + # Requires to setup a cluster + doCheck = false; + + pythonImportsCheck = [ "pulsar" ]; meta = with lib; { - description = "Client for pulsar"; - homepage = "https://pypi.org/project/pulsar-client/"; + 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; [ fab ]; + maintainers = with maintainers; [ gaelreyrol ]; }; } diff --git a/pkgs/development/python-modules/pulsar/default.nix b/pkgs/development/python-modules/pulsar/default.nix deleted file mode 100644 index 84407f37b1c3..000000000000 --- a/pkgs/development/python-modules/pulsar/default.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ - lib, - buildPythonPackage, - fetchFromGitHub, - pythonOlder, - cmake, - pkg-config, - libpulsar, - pybind11, - certifi, -}: - -buildPythonPackage rec { - pname = "pulsar"; - version = "3.6.1"; - format = "setuptools"; - - src = fetchFromGitHub { - owner = "apache"; - repo = "pulsar-client-python"; - tag = "v${version}"; - hash = "sha256-KdPLp0BmZnobU4F6tuMj2DY/ya4QHeGcM/eEAivoXNI="; - }; - - disabled = pythonOlder "3.7"; - - nativeBuildInputs = [ - cmake - pkg-config - ]; - - buildInputs = [ - libpulsar - pybind11 - ]; - - preBuild = '' - make -j$NIX_BUILD_CORES - make install - cd .. - ''; - - propagatedBuildInputs = [ certifi ]; - - # Requires to setup a cluster - doCheck = false; - - pythonImportsCheck = [ "pulsar" ]; - - meta = with lib; { - 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 ]; - }; -} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index fbd80431a5b1..351cc02ffa32 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11724,8 +11724,6 @@ self: super: with self; { pulp = callPackage ../development/python-modules/pulp { }; - pulsar = callPackage ../development/python-modules/pulsar { }; - pulsar-client = callPackage ../development/python-modules/pulsar-client { }; pulsectl = callPackage ../development/python-modules/pulsectl { }; From d3580ff5dd5bda81a755e00b931ebf3a5e4e6b98 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Wed, 28 May 2025 13:35:23 -0700 Subject: [PATCH 2/3] python3Packages.pulsar-client: cleanup --- .../python-modules/pulsar-client/default.nix | 63 ++++++++++++++++--- 1 file changed, 53 insertions(+), 10 deletions(-) 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 ]; }; } From e7afe86149436536a13865bd7ea338fe4b079be2 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Wed, 28 May 2025 13:38:29 -0700 Subject: [PATCH 3/3] python3Packages.pulsar-client: 3.6.1 -> 3.7.0 changelog: https://github.com/apache/pulsar-client-python/releases/tag/v3.7.0 diff: https://github.com/apache/pulsar-client-python/compare/v3.6.1...v3.7.0 --- .../python-modules/pulsar-client/default.nix | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/pkgs/development/python-modules/pulsar-client/default.nix b/pkgs/development/python-modules/pulsar-client/default.nix index c840a160b370..6758e35783be 100644 --- a/pkgs/development/python-modules/pulsar-client/default.nix +++ b/pkgs/development/python-modules/pulsar-client/default.nix @@ -24,24 +24,16 @@ unittestCheckHook, }: -let - functionDependencies = [ - grpcio - prometheus-client - protobuf - ratelimit - ]; -in buildPythonPackage rec { pname = "pulsar-client"; - version = "3.6.1"; + version = "3.7.0"; pyproject = true; src = fetchFromGitHub { owner = "apache"; repo = "pulsar-client-python"; tag = "v${version}"; - hash = "sha256-KdPLp0BmZnobU4F6tuMj2DY/ya4QHeGcM/eEAivoXNI="; + hash = "sha256-M8Y72VgtPdM80AO9jRyyyOFW6wQ7dbKH33alLWcTLV8="; }; build-system = [ @@ -66,20 +58,21 @@ buildPythonPackage rec { dependencies = [ certifi ]; - pythonRemoveDeps = [ - # not avalilable in nixpkgs - "apache-bookkeeper-client" - ]; - optional-dependencies = { - functions = functionDependencies; + functions = [ + # apache-bookkeeper-client + grpcio + prometheus-client + protobuf + ratelimit + ]; avro = [ fastavro ]; - all = functionDependencies ++ [ fastavro ]; + all = lib.flatten (lib.attrValues (lib.filterAttrs (n: v: n != "all") optional-dependencies)); }; nativeCheckInputs = [ unittestCheckHook - ] ++ lib.flatten (lib.attrValues (lib.filterAttrs (n: v: n != "all") optional-dependencies)); + ] ++ optional-dependencies.all; unittestFlagsArray = [ "-s"