2022-09-09 14:08:57 +00:00
|
|
|
{ buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, lib
|
|
|
|
, pythonOlder
|
|
|
|
, poetry-core
|
|
|
|
, grpclib
|
|
|
|
, python-dateutil
|
|
|
|
, black
|
|
|
|
, jinja2
|
|
|
|
, isort
|
|
|
|
, python
|
2024-01-02 11:29:13 +00:00
|
|
|
, pydantic
|
2022-09-09 14:08:57 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, pytest-asyncio
|
|
|
|
, pytest-mock
|
2024-01-25 14:12:00 +00:00
|
|
|
, typing-extensions
|
2022-09-09 14:08:57 +00:00
|
|
|
, tomlkit
|
|
|
|
, grpcio-tools
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "betterproto";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "2.0.0b6";
|
2024-01-25 14:12:00 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.9";
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "danielgtaylor";
|
|
|
|
repo = "python-betterproto";
|
2024-01-25 14:12:00 +00:00
|
|
|
rev = "refs/tags/v.${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-ZuVq4WERXsRFUPNNTNp/eisWX1MyI7UtwqEI8X93wYI=";
|
2022-09-09 14:08:57 +00:00
|
|
|
};
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
poetry-core
|
|
|
|
];
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
grpclib
|
|
|
|
python-dateutil
|
2024-01-25 14:12:00 +00:00
|
|
|
typing-extensions
|
2022-09-09 14:08:57 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
passthru.optional-dependencies.compiler = [
|
|
|
|
black
|
|
|
|
jinja2
|
|
|
|
isort
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2024-01-25 14:12:00 +00:00
|
|
|
grpcio-tools
|
2024-01-02 11:29:13 +00:00
|
|
|
pydantic
|
2022-09-09 14:08:57 +00:00
|
|
|
pytest-asyncio
|
|
|
|
pytest-mock
|
2024-01-25 14:12:00 +00:00
|
|
|
pytestCheckHook
|
2022-09-09 14:08:57 +00:00
|
|
|
tomlkit
|
2024-01-25 14:12:00 +00:00
|
|
|
] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"betterproto"
|
|
|
|
];
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
# 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
|
2024-01-02 11:29:13 +00:00
|
|
|
patchShebangs src/betterproto/plugin/main.py
|
2022-09-09 14:08:57 +00:00
|
|
|
${python.interpreter} -m tests.generate
|
|
|
|
'';
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
disabledTestPaths = [
|
|
|
|
# https://github.com/danielgtaylor/python-betterproto/issues/530
|
|
|
|
"tests/inputs/oneof/test_oneof.py"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
"test_pydantic_no_value"
|
|
|
|
];
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
meta = with lib; {
|
2024-01-25 14:12:00 +00:00
|
|
|
description = "Code generator & library for Protobuf 3 and async gRPC";
|
2022-09-09 14:08:57 +00:00
|
|
|
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";
|
2024-01-25 14:12:00 +00:00
|
|
|
changelog = "https://github.com/danielgtaylor/python-betterproto/blob/v.${version}/CHANGELOG.md";
|
2022-09-09 14:08:57 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ nikstur ];
|
|
|
|
};
|
|
|
|
}
|