1{ buildPythonPackage 2, fetchFromGitHub 3, lib 4, pythonOlder 5, poetry-core 6, grpclib 7, python-dateutil 8, dataclasses 9, black 10, jinja2 11, isort 12, python 13, pytestCheckHook 14, pytest-asyncio 15, pytest-mock 16, tomlkit 17, grpcio-tools 18}: 19 20buildPythonPackage rec { 21 pname = "betterproto"; 22 version = "2.0.0b5"; 23 format = "pyproject"; 24 disabled = pythonOlder "3.6"; 25 26 src = fetchFromGitHub { 27 owner = "danielgtaylor"; 28 repo = "python-betterproto"; 29 rev = "v${version}"; 30 sha256 = "sha256-XyXdpo3Yo4aO1favMWC7i9utz4fNDbKbsnYXJW0b7Gc="; 31 }; 32 33 nativeBuildInputs = [ poetry-core ]; 34 35 propagatedBuildInputs = [ 36 grpclib 37 python-dateutil 38 ] ++ lib.optionals (pythonOlder "3.7") [ 39 dataclasses 40 ]; 41 42 passthru.optional-dependencies.compiler = [ 43 black 44 jinja2 45 isort 46 ]; 47 48 pythonImportsCheck = [ "betterproto" ]; 49 50 checkInputs = [ 51 pytestCheckHook 52 pytest-asyncio 53 pytest-mock 54 tomlkit 55 grpcio-tools 56 ] ++ passthru.optional-dependencies.compiler; 57 58 # The tests require the generation of code before execution. This requires 59 # the protoc-gen-python_betterproto script from the packge to be on PATH. 60 preCheck = '' 61 export PATH=$PATH:$out/bin 62 ${python.interpreter} -m tests.generate 63 ''; 64 65 meta = with lib; { 66 description = "Clean, modern, Python 3.6+ code generator & library for Protobuf 3 and async gRPC"; 67 longDescription = '' 68 This project aims to provide an improved experience when using Protobuf / 69 gRPC in a modern Python environment by making use of modern language 70 features and generating readable, understandable, idiomatic Python code. 71 ''; 72 homepage = "https://github.com/danielgtaylor/python-betterproto"; 73 license = licenses.mit; 74 maintainers = with maintainers; [ nikstur ]; 75 }; 76}