1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, pythonOlder
6, poetry-core
7, grpcio
8, protobuf
9, pytest-asyncio
10, pytestCheckHook
11}:
12
13buildPythonPackage rec {
14 pname = "grpc-interceptor";
15 version = "0.15.3";
16 format = "pyproject";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "d5h-foss";
22 repo = pname;
23 rev = "refs/tags/v${version}";
24 hash = "sha256-tTi1X1r7584ZXa12eLp2G/Am8G6Dnd18eE5wF/Lp/EY=";
25 };
26
27 patches = [
28 # https://github.com/d5h-foss/grpc-interceptor/pull/44
29 (fetchpatch {
30 name = "replace-poetry-with-poetry-core.patch";
31 url = "https://github.com/d5h-foss/grpc-interceptor/commit/916cb394acd8dd7abb4f5edcb4e88aee961a32d0.patch";
32 hash = "sha256-W2SF2zyjusTxgvCxBDLpisD03bofzDug1eyd4FLJmKs=";
33 })
34 ];
35
36 nativeBuildInputs = [
37 poetry-core
38 ];
39
40 propagatedBuildInputs = [
41 grpcio
42 protobuf
43 ];
44
45 __darwinAllowLocalNetworking = true;
46
47 nativeCheckInputs = [
48 pytest-asyncio
49 pytestCheckHook
50 ];
51
52 pythonImportsCheck = [
53 "grpc_interceptor"
54 ];
55
56 meta = with lib; {
57 description = "Simplified gRPC interceptors";
58 homepage = "https://github.com/d5h-foss/grpc-interceptor";
59 changelog = "https://github.com/d5h-foss/grpc-interceptor/releases/tag/v${version}";
60 longDescription = ''
61 Simplified Python gRPC interceptors.
62
63 The Python gRPC package provides service interceptors, but they're a bit
64 hard to use because of their flexibility. The gRPC interceptors don't
65 have direct access to the request and response objects, or the service
66 context. Access to these are often desired, to be able to log data in the
67 request or response, or set status codes on the context.
68 '';
69 license = licenses.mit;
70 maintainers = with maintainers; [ tomaskala ];
71 };
72}