2022-09-09 14:08:57 +00:00
|
|
|
{ buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, lib
|
|
|
|
, pythonOlder
|
|
|
|
, poetry-core
|
|
|
|
, grpclib
|
|
|
|
, python-dateutil
|
|
|
|
, black
|
|
|
|
, jinja2
|
|
|
|
, isort
|
|
|
|
, python
|
|
|
|
, pytestCheckHook
|
|
|
|
, pytest-asyncio
|
|
|
|
, pytest-mock
|
|
|
|
, tomlkit
|
|
|
|
, grpcio-tools
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "betterproto";
|
|
|
|
version = "2.0.0b5";
|
|
|
|
format = "pyproject";
|
2022-12-17 10:02:37 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "danielgtaylor";
|
|
|
|
repo = "python-betterproto";
|
|
|
|
rev = "v${version}";
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-XyXdpo3Yo4aO1favMWC7i9utz4fNDbKbsnYXJW0b7Gc=";
|
2022-09-09 14:08:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ poetry-core ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
grpclib
|
|
|
|
python-dateutil
|
|
|
|
];
|
|
|
|
|
|
|
|
passthru.optional-dependencies.compiler = [
|
|
|
|
black
|
|
|
|
jinja2
|
|
|
|
isort
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "betterproto" ];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-09-09 14:08:57 +00:00
|
|
|
pytestCheckHook
|
|
|
|
pytest-asyncio
|
|
|
|
pytest-mock
|
|
|
|
tomlkit
|
|
|
|
grpcio-tools
|
|
|
|
] ++ passthru.optional-dependencies.compiler;
|
|
|
|
|
|
|
|
# The tests require the generation of code before execution. This requires
|
2023-05-24 13:37:59 +00:00
|
|
|
# the protoc-gen-python_betterproto script from the package to be on PATH.
|
2022-09-09 14:08:57 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|