From f181ead1de440a266f7e88e7840d3f3e5c786e5b Mon Sep 17 00:00:00 2001 From: mrkaye97 Date: Thu, 30 Jan 2025 11:48:36 -0500 Subject: [PATCH 1/2] fix: generate using older grpcio ver --- generate.sh | 8 ++++++++ hatchet_sdk/contracts/dispatcher_pb2.py | 12 +----------- hatchet_sdk/contracts/dispatcher_pb2_grpc.py | 9 +++++++-- hatchet_sdk/contracts/events_pb2.py | 12 +----------- hatchet_sdk/contracts/events_pb2_grpc.py | 9 +++++++-- hatchet_sdk/contracts/workflows_pb2.py | 12 +----------- hatchet_sdk/contracts/workflows_pb2_grpc.py | 9 +++++++-- 7 files changed, 32 insertions(+), 39 deletions(-) diff --git a/generate.sh b/generate.sh index 401783e8..77c1ef73 100755 --- a/generate.sh +++ b/generate.sh @@ -58,10 +58,18 @@ cp $tmp_dir/hatchet_sdk/clients/rest/api/__init__.py $dst_dir/api/__init__.py # remove tmp folder rm -rf $tmp_dir + +MIN_GRPCIO_VERSION=$(grep -A 1 'grpcio =' pyproject.toml | grep 'version' | sed -E 's/.*">=([0-9]+\.[0-9]+\.[0-9]+).*/\1/' | sort -V | head -n 1 +) + +poetry add "grpcio@$MIN_GRPCIO_VERSION" "grpcio-tools@$MIN_GRPCIO_VERSION" + poetry run python -m grpc_tools.protoc --proto_path=../oss/api-contracts/dispatcher --python_out=./hatchet_sdk/contracts --pyi_out=./hatchet_sdk/contracts --grpc_python_out=./hatchet_sdk/contracts dispatcher.proto poetry run python -m grpc_tools.protoc --proto_path=../oss/api-contracts/events --python_out=./hatchet_sdk/contracts --pyi_out=./hatchet_sdk/contracts --grpc_python_out=./hatchet_sdk/contracts events.proto poetry run python -m grpc_tools.protoc --proto_path=../oss/api-contracts/workflows --python_out=./hatchet_sdk/contracts --pyi_out=./hatchet_sdk/contracts --grpc_python_out=./hatchet_sdk/contracts workflows.proto +git restore pyproject.toml poetry.lock + # Fix relative imports in _grpc.py files if [[ "$OSTYPE" == "darwin"* ]]; then # macOS diff --git a/hatchet_sdk/contracts/dispatcher_pb2.py b/hatchet_sdk/contracts/dispatcher_pb2.py index 86c4d0d7..5a939ebd 100644 --- a/hatchet_sdk/contracts/dispatcher_pb2.py +++ b/hatchet_sdk/contracts/dispatcher_pb2.py @@ -1,22 +1,12 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE # source: dispatcher.proto -# Protobuf Python Version: 5.29.0 +# Protobuf Python Version: 5.26.1 """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, - 29, - 0, - '', - 'dispatcher.proto' -) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() diff --git a/hatchet_sdk/contracts/dispatcher_pb2_grpc.py b/hatchet_sdk/contracts/dispatcher_pb2_grpc.py index 520f2ed5..6b0d8cf3 100644 --- a/hatchet_sdk/contracts/dispatcher_pb2_grpc.py +++ b/hatchet_sdk/contracts/dispatcher_pb2_grpc.py @@ -5,8 +5,10 @@ from . import dispatcher_pb2 as dispatcher__pb2 -GRPC_GENERATED_VERSION = '1.69.0' +GRPC_GENERATED_VERSION = '1.64.1' GRPC_VERSION = grpc.__version__ +EXPECTED_ERROR_RELEASE = '1.65.0' +SCHEDULED_RELEASE_DATE = 'June 25, 2024' _version_not_supported = False try: @@ -16,12 +18,15 @@ _version_not_supported = True if _version_not_supported: - raise RuntimeError( + warnings.warn( f'The grpc package installed is at version {GRPC_VERSION},' + f' but the generated code in dispatcher_pb2_grpc.py depends on' + f' grpcio>={GRPC_GENERATED_VERSION}.' + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + + f' This warning will become an error in {EXPECTED_ERROR_RELEASE},' + + f' scheduled for release on {SCHEDULED_RELEASE_DATE}.', + RuntimeWarning ) diff --git a/hatchet_sdk/contracts/events_pb2.py b/hatchet_sdk/contracts/events_pb2.py index 8248e0cf..f0a26fce 100644 --- a/hatchet_sdk/contracts/events_pb2.py +++ b/hatchet_sdk/contracts/events_pb2.py @@ -1,22 +1,12 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE # source: events.proto -# Protobuf Python Version: 5.29.0 +# Protobuf Python Version: 5.26.1 """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, - 29, - 0, - '', - 'events.proto' -) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() diff --git a/hatchet_sdk/contracts/events_pb2_grpc.py b/hatchet_sdk/contracts/events_pb2_grpc.py index 6c83a444..ddea5aa4 100644 --- a/hatchet_sdk/contracts/events_pb2_grpc.py +++ b/hatchet_sdk/contracts/events_pb2_grpc.py @@ -5,8 +5,10 @@ from . import events_pb2 as events__pb2 -GRPC_GENERATED_VERSION = '1.69.0' +GRPC_GENERATED_VERSION = '1.64.1' GRPC_VERSION = grpc.__version__ +EXPECTED_ERROR_RELEASE = '1.65.0' +SCHEDULED_RELEASE_DATE = 'June 25, 2024' _version_not_supported = False try: @@ -16,12 +18,15 @@ _version_not_supported = True if _version_not_supported: - raise RuntimeError( + warnings.warn( f'The grpc package installed is at version {GRPC_VERSION},' + f' but the generated code in events_pb2_grpc.py depends on' + f' grpcio>={GRPC_GENERATED_VERSION}.' + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + + f' This warning will become an error in {EXPECTED_ERROR_RELEASE},' + + f' scheduled for release on {SCHEDULED_RELEASE_DATE}.', + RuntimeWarning ) diff --git a/hatchet_sdk/contracts/workflows_pb2.py b/hatchet_sdk/contracts/workflows_pb2.py index 083d54c1..a2010e39 100644 --- a/hatchet_sdk/contracts/workflows_pb2.py +++ b/hatchet_sdk/contracts/workflows_pb2.py @@ -1,22 +1,12 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE # source: workflows.proto -# Protobuf Python Version: 5.29.0 +# Protobuf Python Version: 5.26.1 """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, - 29, - 0, - '', - 'workflows.proto' -) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() diff --git a/hatchet_sdk/contracts/workflows_pb2_grpc.py b/hatchet_sdk/contracts/workflows_pb2_grpc.py index d8cc58a2..383170e2 100644 --- a/hatchet_sdk/contracts/workflows_pb2_grpc.py +++ b/hatchet_sdk/contracts/workflows_pb2_grpc.py @@ -5,8 +5,10 @@ from . import workflows_pb2 as workflows__pb2 -GRPC_GENERATED_VERSION = '1.69.0' +GRPC_GENERATED_VERSION = '1.64.1' GRPC_VERSION = grpc.__version__ +EXPECTED_ERROR_RELEASE = '1.65.0' +SCHEDULED_RELEASE_DATE = 'June 25, 2024' _version_not_supported = False try: @@ -16,12 +18,15 @@ _version_not_supported = True if _version_not_supported: - raise RuntimeError( + warnings.warn( f'The grpc package installed is at version {GRPC_VERSION},' + f' but the generated code in workflows_pb2_grpc.py depends on' + f' grpcio>={GRPC_GENERATED_VERSION}.' + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + + f' This warning will become an error in {EXPECTED_ERROR_RELEASE},' + + f' scheduled for release on {SCHEDULED_RELEASE_DATE}.', + RuntimeWarning ) From fa03c4f7a758effff89a91b4e2a9bd95ae984139 Mon Sep 17 00:00:00 2001 From: mrkaye97 Date: Thu, 30 Jan 2025 11:49:12 -0500 Subject: [PATCH 2/2] chore: ver --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2313c638..d021be51 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "hatchet-sdk" -version = "0.45.1" +version = "0.45.2" description = "" authors = ["Alexander Belanger "] readme = "README.md" @@ -9,12 +9,12 @@ include = ["hatchet_sdk/py.typed"] [tool.poetry.dependencies] python = "^3.10" grpcio = [ - { version = ">=1.64.1, !=1.68.*", markers = "python_version < '3.13'" }, - { version = ">=1.69.0", markers = "python_version >= '3.13'" } + { version = ">=1.64.1, !=1.68.*", markers = "python_version < '3.13'" }, + { version = ">=1.69.0", markers = "python_version >= '3.13'" }, ] grpcio-tools = [ - { version = ">=1.64.1, !=1.68.*", markers = "python_version < '3.13'" }, - { version = ">=1.69.0", markers = "python_version >= '3.13'" } + { version = ">=1.64.1, !=1.68.*", markers = "python_version < '3.13'" }, + { version = ">=1.69.0", markers = "python_version >= '3.13'" }, ] python-dotenv = "^1.0.0" protobuf = "^5.29.1"