1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 poetry-core,
6 astunparse,
7 grpcio-tools,
8 click,
9 pkgs,
10 protobuf,
11 mypy-protobuf,
12 pytestCheckHook,
13 writableTmpDirAsHomeHook,
14}:
15buildPythonPackage rec {
16 pname = "protoletariat";
17 version = "3.3.10";
18 pyproject = true;
19
20 src = fetchFromGitHub {
21 owner = "cpcloud";
22 repo = "protoletariat";
23 tag = version;
24 hash = "sha256-oaZmgen/7WkX+nNuphrcyniL7Z/OaeqlcnbCnqR5h0w=";
25 };
26
27 build-system = [ poetry-core ];
28
29 dependencies = [
30 astunparse
31 click
32 grpcio-tools
33 protobuf
34 ];
35
36 pythonRelaxDeps = [
37 "protobuf"
38 ];
39
40 postPatch = ''
41 substituteInPlace protoletariat/__main__.py \
42 --replace-fail 'default="protoc",' 'default="${lib.getExe' pkgs.protobuf "protoc"}",'
43 '';
44
45 pythonImportsCheck = [ "protoletariat" ];
46
47 nativeCheckInputs = [
48 pytestCheckHook
49 writableTmpDirAsHomeHook
50 mypy-protobuf
51 ];
52
53 meta = {
54 description = "Python protocol buffers for the rest of us";
55 changelog = "https://github.com/cpcloud/protoletariat/blob/${version}/CHANGELOG.md";
56 license = with lib.licenses; [ asl20 ];
57 maintainers = with lib.maintainers; [ sigmanificient ];
58 };
59}