diff --git a/pkgs/development/python-modules/protobuf-py/default.nix b/pkgs/development/python-modules/protobuf-py/default.nix new file mode 100644 index 000000000000..8a01100ac9c5 --- /dev/null +++ b/pkgs/development/python-modules/protobuf-py/default.nix @@ -0,0 +1,51 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + + # build-system + uv-build, + + # dependencies + protobuf-py-ext, +}: + +buildPythonPackage (finalAttrs: { + pname = "protobuf-py"; + # connectrpc requires this exact version and e2b requires <0.2; bump all three + # together. + version = "0.1.1"; + pyproject = true; + __structuredAttrs = true; + + # No tag on GitHub for this release: bufbuild/protobuf-py's only tag is v0.2.0, + # which connectrpc (`protobuf-py==0.1.1`) and e2b (`<0.2`) do not accept yet. + src = fetchPypi { + pname = "protobuf_py"; + inherit (finalAttrs) version; + hash = "sha256-a9CKxNjxZhllu+JoVCnXkENwTN0e5yCnqJYXMxdCJAs="; + }; + + build-system = [ + uv-build + ]; + + dependencies = [ + protobuf-py-ext + ]; + + pythonImportsCheck = [ "protobuf" ]; + + # The test suite is not part of the PyPI sdist and there is no git tag for this + # release. Note that protobuf swallows an ImportError from protobuf_ext and + # falls back to pure Python, so a broken accelerator would not surface here — + # protobuf-py-ext's own pythonImportsCheck is what guards that. + doCheck = false; + + meta = { + description = "Idiomatic Protocol Buffers for Python"; + homepage = "https://github.com/bufbuild/protobuf-py"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ mishushakov ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index e4034114f142..e0ae79a0b42a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13663,6 +13663,8 @@ self: super: with self; { # If a protobuf upgrade causes many Python packages to fail, please pin it here to the previous version. protobuf = protobuf7; + protobuf-py = callPackage ../development/python-modules/protobuf-py { }; + protobuf-py-ext = callPackage ../development/python-modules/protobuf-py-ext { }; protobuf3-to-dict = callPackage ../development/python-modules/protobuf3-to-dict { };