1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 c-ares,
6 cython,
7 fetchPypi,
8 openssl,
9 pkg-config,
10 protobuf,
11 pythonOlder,
12 setuptools,
13 zlib,
14}:
15
16# This package should be updated together with the main grpc package and other
17# related python grpc packages.
18# nixpkgs-update: no auto update
19buildPythonPackage rec {
20 pname = "grpcio";
21 version = "1.71.0";
22 pyproject = true;
23
24 disabled = pythonOlder "3.8";
25
26 src = fetchPypi {
27 inherit pname version;
28 hash = "sha256-K4X3ggR1rT7ewgnT2Jp5Ca2hbKqwXT8uCKforjIApVw=";
29 };
30
31 outputs = [
32 "out"
33 "dev"
34 ];
35
36 build-system = [ setuptools ];
37
38 nativeBuildInputs = [
39 cython
40 pkg-config
41 ];
42
43 buildInputs = [
44 c-ares
45 openssl
46 zlib
47 ];
48
49 dependencies = [ protobuf ];
50
51 preBuild =
52 ''
53 export GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS="$NIX_BUILD_CORES"
54 if [ -z "$enableParallelBuilding" ]; then
55 GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS=1
56 fi
57 ''
58 + lib.optionalString stdenv.hostPlatform.isDarwin ''
59 unset AR
60 '';
61
62 GRPC_BUILD_WITH_BORING_SSL_ASM = "";
63 GRPC_PYTHON_BUILD_SYSTEM_OPENSSL = 1;
64 GRPC_PYTHON_BUILD_SYSTEM_ZLIB = 1;
65 GRPC_PYTHON_BUILD_SYSTEM_CARES = 1;
66
67 # does not contain any tests
68 doCheck = false;
69
70 enableParallelBuilding = true;
71
72 pythonImportsCheck = [ "grpc" ];
73
74 meta = with lib; {
75 description = "HTTP/2-based RPC framework";
76 homepage = "https://grpc.io/grpc/python/";
77 changelog = "https://github.com/grpc/grpc/releases/tag/v${version}";
78 license = licenses.asl20;
79 maintainers = [ ];
80 };
81}