Unverified Commit 3f49ff3c authored by Theodore Ni's avatar Theodore Ni Committed by GitHub
Browse files

python312Packages.dbt-common: 1.11.0 -> 1.12.0; apply protobuf 5 patch (#354052)

parents 90fcec9b d0eaae15
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -25,32 +25,35 @@
  pytestCheckHook,
  pytest-mock,
  pytest-xdist,
  numpy,
}:

buildPythonPackage rec {
  pname = "dbt-common";
  version = "1.11.0";
  version = "1.12.0";
  pyproject = true;

  disabled = pythonOlder "3.8";
  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "dbt-labs";
    repo = "dbt-common";
    # Unfortunatly, upstream doesn't tag commits on GitHub, and the pypi source
    # Unfortunately, upstream doesn't tag commits on GitHub, and the pypi source
    # doesn't include tests. TODO: Write an update script that will detect the
    # version from `dbt_common/__about__.py`.
    rev = "ed11c6ceb4f29d4a79489469309d9ce9dd1757e6";
    hash = "sha256-JA6hFQwF7h1tXyCxBVKGgyevdTxyYeN3I/Bwy9uoC0Y=";
    rev = "5a401a9e8dd46e4582ac4edd2883e34714e77530";
    hash = "sha256-SIMg6ewnE6kY+drqcPlYrxt1XlWBurZU62FI/QnHAHY=";
  };

  patches = [
    # https://github.com/dbt-labs/dbt-common/pull/211
    ./protobuf_5.patch
  ];

  build-system = [ hatchling ];

  pythonRelaxDeps = [
    "agate"
    "deepdiff"
    "protobuf"
  ];

  dependencies = [
@@ -73,12 +76,14 @@ buildPythonPackage rec {
    pytest-xdist
    pytest-mock
  ];

  disabledTests = [
    # Assertion errors (TODO: Notify upstream)
    "test_create_print_json"
    "test_events"
    "test_extra_dict_on_event"
  ];

  pythonImportsCheck = [ "dbt_common" ];

  meta = {
+113 −0
Original line number Diff line number Diff line
From f7c480139015cb8746f3fa751dc72b788d0ce8a0 Mon Sep 17 00:00:00 2001
From: Eric Hauser <ewhauser@gmail.com>
Date: Sat, 19 Oct 2024 15:52:16 -0600
Subject: [PATCH] upgrade protobuf to >=5,<6

---
 dbt_common/events/base_types.py |  7 +++++--
 dbt_common/events/functions.py  |  2 +-
 dbt_common/events/types_pb2.py  | 18 ++++++++++++++----
 pyproject.toml                  |  4 ++--
 4 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/dbt_common/events/base_types.py b/dbt_common/events/base_types.py
index 781b2a0e..2f11e4c7 100644
--- a/dbt_common/events/base_types.py
+++ b/dbt_common/events/base_types.py
@@ -91,15 +91,18 @@ def __getattr__(self, key):
 
     def to_dict(self):
         return MessageToDict(
-            self.pb_msg, preserving_proto_field_name=True, including_default_value_fields=True
+            self.pb_msg,
+            preserving_proto_field_name=True,
+            always_print_fields_with_no_presence=True,
         )
 
     def to_json(self) -> str:
         return MessageToJson(
             self.pb_msg,
             preserving_proto_field_name=True,
-            including_default_value_fields=True,
+            always_print_fields_with_no_presence=True,
             indent=None,
+            sort_keys=True,
         )
 
     def level_tag(self) -> EventLevel:
diff --git a/dbt_common/events/functions.py b/dbt_common/events/functions.py
index 4e055aa4..86d68237 100644
--- a/dbt_common/events/functions.py
+++ b/dbt_common/events/functions.py
@@ -97,7 +97,7 @@ def msg_to_dict(msg: EventMsg) -> dict:
         msg_dict = MessageToDict(
             msg,
             preserving_proto_field_name=True,
-            including_default_value_fields=True,  # type: ignore
+            always_print_fields_with_no_presence=True,
         )
     except Exception as exc:
         event_type = type(msg).__name__
diff --git a/dbt_common/events/types_pb2.py b/dbt_common/events/types_pb2.py
index 6574462e..1a3b91a5 100644
--- a/dbt_common/events/types_pb2.py
+++ b/dbt_common/events/types_pb2.py
@@ -1,12 +1,22 @@
 # -*- coding: utf-8 -*-
 # Generated by the protocol buffer compiler.  DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
 # source: types.proto
-# Protobuf Python Version: 4.25.2
+# Protobuf Python Version: 5.28.2
 """Generated protocol buffer code."""
 from google.protobuf import descriptor as _descriptor
 from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
 from google.protobuf import symbol_database as _symbol_database
 from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+    _runtime_version.Domain.PUBLIC,
+    5,
+    28,
+    2,
+    '',
+    'types.proto'
+)
 # @@protoc_insertion_point(imports)
 
 _sym_db = _symbol_database.Default()
@@ -20,9 +30,9 @@
 _globals = globals()
 _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
 _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'types_pb2', _globals)
-if _descriptor._USE_C_DESCRIPTORS == False:
-  DESCRIPTOR._options = None
-  _globals['_EVENTINFO_EXTRAENTRY']._options = None
+if not _descriptor._USE_C_DESCRIPTORS:
+  DESCRIPTOR._loaded_options = None
+  _globals['_EVENTINFO_EXTRAENTRY']._loaded_options = None
   _globals['_EVENTINFO_EXTRAENTRY']._serialized_options = b'8\001'
   _globals['_EVENTINFO']._serialized_start=62
   _globals['_EVENTINFO']._serialized_end=335
diff --git a/pyproject.toml b/pyproject.toml
index 2e40385c..c2878d15 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -36,7 +36,7 @@ dependencies = [
   "Jinja2>=3.1.3,<4",
   "mashumaro[msgpack]>=3.9,<4.0",
   "pathspec>=0.9,<0.13",
-  "protobuf>=4.0.0,<5.0.0",
+  "protobuf>=5.0,<6.0",
   "python-dateutil>=2.0,<3.0",
   "requests<3.0.0",  # needs to match dbt-core
   "typing-extensions>=4.4,<5.0",
@@ -52,7 +52,7 @@ lint = [
     "pytest>=7.3,<8.0",  # needed for linting tests
     "types-Jinja2>=2.11,<3.0",
     "types-jsonschema>=4.17,<5.0",
-    "types-protobuf>=4.24,<5.0",
+    "types-protobuf>=5.0,<6.0",
     "types-python-dateutil>=2.8,<3.0",
     "types-PyYAML>=6.0,<7.0",
     "types-requests"