depot/third_party/nixpkgs/pkgs/development/python-modules/betterproto/default.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

76 lines
1.7 KiB
Nix

{ buildPythonPackage
, fetchFromGitHub
, lib
, pythonOlder
, poetry-core
, grpclib
, python-dateutil
, black
, jinja2
, isort
, python
, pydantic
, pytestCheckHook
, pytest-asyncio
, pytest-mock
, tomlkit
, grpcio-tools
}:
buildPythonPackage rec {
pname = "betterproto";
version = "2.0.0b6";
format = "pyproject";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "danielgtaylor";
repo = "python-betterproto";
rev = "v.${version}";
hash = "sha256-ZuVq4WERXsRFUPNNTNp/eisWX1MyI7UtwqEI8X93wYI=";
};
nativeBuildInputs = [ poetry-core ];
propagatedBuildInputs = [
grpclib
python-dateutil
];
passthru.optional-dependencies.compiler = [
black
jinja2
isort
];
pythonImportsCheck = [ "betterproto" ];
nativeCheckInputs = [
pydantic
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 package to be on PATH.
preCheck = ''
export PATH=$PATH:$out/bin
patchShebangs src/betterproto/plugin/main.py
${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 ];
};
}