From 4c6a22163a95542e357afe0a1a1251d7943f625a Mon Sep 17 00:00:00 2001 From: nikstur <61635709+nikstur@users.noreply.github.com> Date: Wed, 24 Aug 2022 23:51:11 +0200 Subject: [PATCH] python3Packages.betterproto: init at 2.0.0b5 (#187533) Co-authored-by: Sandro --- .../python-modules/betterproto/default.nix | 76 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 78 insertions(+) create mode 100644 pkgs/development/python-modules/betterproto/default.nix diff --git a/pkgs/development/python-modules/betterproto/default.nix b/pkgs/development/python-modules/betterproto/default.nix new file mode 100644 index 00000000000..2f6ba2e29a2 --- /dev/null +++ b/pkgs/development/python-modules/betterproto/default.nix @@ -0,0 +1,76 @@ +{ buildPythonPackage +, fetchFromGitHub +, lib +, pythonOlder +, poetry-core +, grpclib +, python-dateutil +, dataclasses +, black +, jinja2 +, isort +, python +, pytestCheckHook +, pytest-asyncio +, pytest-mock +, tomlkit +, grpcio-tools +}: + +buildPythonPackage rec { + pname = "betterproto"; + version = "2.0.0b5"; + format = "pyproject"; + disabled = pythonOlder "3.6"; + + src = fetchFromGitHub { + owner = "danielgtaylor"; + repo = "python-betterproto"; + rev = "v${version}"; + sha256 = "sha256-XyXdpo3Yo4aO1favMWC7i9utz4fNDbKbsnYXJW0b7Gc="; + }; + + nativeBuildInputs = [ poetry-core ]; + + propagatedBuildInputs = [ + grpclib + python-dateutil + ] ++ lib.optional (pythonOlder "3.7") [ + dataclasses + ]; + + passthru.optional-dependencies.compiler = [ + black + jinja2 + isort + ]; + + pythonImportsCheck = [ "betterproto" ]; + + checkInputs = [ + pytestCheckHook + pytest-asyncio + pytest-mock + tomlkit + grpcio-tools + ] ++ passthru.optional-dependencies.compiler; + + # The tests require the generation of code before execution. This requires + # the protoc-gen-python_betterproto script from the packge to be on PATH. + preCheck = '' + export PATH=$PATH:$out/bin + ${python.interpreter} -m tests.generate + ''; + + meta = with lib; { + description = "Clean, modern, Python 3.6+ code generator & library for Protobuf 3 and async gRPC"; + longDescription = '' + This project aims to provide an improved experience when using Protobuf / + gRPC in a modern Python environment by making use of modern language + features and generating readable, understandable, idiomatic Python code. + ''; + homepage = "https://github.com/danielgtaylor/python-betterproto"; + license = licenses.mit; + maintainers = with maintainers; [ nikstur ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 1fd2fa21de0..e9c527bf12f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1306,6 +1306,8 @@ in { betamax-serializers = callPackage ../development/python-modules/betamax-serializers { }; + betterproto = callPackage ../development/python-modules/betterproto { }; + bibtexparser = callPackage ../development/python-modules/bibtexparser { }; bidict = callPackage ../development/python-modules/bidict { };