1{
2 buildPythonPackage,
3 fetchPypi,
4 grpcio-tools,
5 lib,
6 mypy-protobuf,
7 protobuf,
8 pytestCheckHook,
9 pythonOlder,
10 pythonRelaxDepsHook,
11 setuptools,
12 testers,
13 types-protobuf,
14}:
15
16buildPythonPackage rec {
17 pname = "mypy-protobuf";
18 version = "3.6.0";
19 pyproject = true;
20
21 disabled = pythonOlder "3.8";
22
23 src = fetchPypi {
24 inherit pname version;
25 hash = "sha256-AvJC6zQJ9miJ8rGjqlg1bsTZCc3Q+TEVYi6ecDZuyjw=";
26 };
27
28 nativeBuildInputs = [ pythonRelaxDepsHook ];
29
30 pythonRelaxDeps = [ "protobuf" ];
31
32 build-system = [ setuptools ];
33
34 dependencies = [
35 grpcio-tools
36 protobuf
37 types-protobuf
38 ];
39
40 doCheck = false; # ModuleNotFoundError: No module named 'testproto'
41
42 nativeCheckInputs = [ pytestCheckHook ];
43
44 pythonImportsCheck = [ "mypy_protobuf" ];
45
46 passthru.tests.version = testers.testVersion {
47 package = mypy-protobuf;
48 command = "${lib.getExe mypy-protobuf} --version";
49 };
50
51 meta = {
52 changelog = "https://github.com/nipunn1313/mypy-protobuf/blob/v${version}/CHANGELOG.md";
53 description = "Generate mypy stub files from protobuf specs";
54 homepage = "https://github.com/nipunn1313/mypy-protobuf";
55 license = lib.licenses.asl20;
56 mainProgram = "protoc-gen-mypy";
57 maintainers = with lib.maintainers; [ lnl7 ];
58 };
59}