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