From ab54fb2510e57b22b712117f7fc281bf9bcbd14d Mon Sep 17 00:00:00 2001 From: Joseph Wang Date: Wed, 23 Jul 2025 17:16:45 -0700 Subject: [PATCH 1/3] chore: Force grpcio-tools dev dependency to <1.66.0 to allow grpcio compatibility with <1.66.0 --- CHANGELOG.md | 3 ++- pydgraph/proto/api_pb2.py | 12 +----------- pydgraph/proto/api_pb2_grpc.py | 9 +++++++-- pyproject.toml | 4 +++- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee7f7be..cb92a52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [v24.2.1] 2025-04-02 +## [v24.2.1] 2025-07-23 **_Chore_** - Updated generated modules following a grpc deps update +- Bump down dev dependency `grpcio-tools` to <1.66.0 to allow `grpcio` compatibility with <1.66.0 (broken in v24.0.2) (#270) ## [v24.2.0] - 2025-04-01 diff --git a/pydgraph/proto/api_pb2.py b/pydgraph/proto/api_pb2.py index d891f39..413f23b 100644 --- a/pydgraph/proto/api_pb2.py +++ b/pydgraph/proto/api_pb2.py @@ -1,22 +1,12 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE # source: api.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, - '', - 'api.proto' -) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() diff --git a/pydgraph/proto/api_pb2_grpc.py b/pydgraph/proto/api_pb2_grpc.py index 24dec7b..4b689dd 100644 --- a/pydgraph/proto/api_pb2_grpc.py +++ b/pydgraph/proto/api_pb2_grpc.py @@ -5,8 +5,10 @@ import api_pb2 as api__pb2 -GRPC_GENERATED_VERSION = '1.71.0' +GRPC_GENERATED_VERSION = '1.65.5' GRPC_VERSION = grpc.__version__ +EXPECTED_ERROR_RELEASE = '1.66.0' +SCHEDULED_RELEASE_DATE = 'August 6, 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 api_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/pyproject.toml b/pyproject.toml index 3052276..f39a31f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,9 @@ dynamic = ["version"] version = { attr = "pydgraph.meta.VERSION" } [project.optional-dependencies] -dev = ["build>=1.2.2.post1", "grpcio-tools>=1.68.0", "pytest>=8.3.3"] +# grpcio-tools 1.66.0 breaks compatibility with grpcio <1.66.0 +# but does not change the generated gRPC output for pydgraph +dev = ["build>=1.2.2.post1", "grpcio-tools>=1.65.0,<1.66.0", "pytest>=8.3.3"] [project.urls] "Homepage" = "https://github.com/hypermodeinc/pydgraph" From f6e1da44f3a8ccc22198f4e5061fc3002d820d86 Mon Sep 17 00:00:00 2001 From: Joseph Wang Date: Thu, 24 Jul 2025 12:14:49 -0700 Subject: [PATCH 2/3] Apply matthewmcneely patches [PATCH 1/3] Remove python 3.13 from testing; update docs [PATCH 2/3] Add a function to display current Dgraph version active in tests [PATCH 3/3] Bump pydgraph version --- .github/workflows/ci-pydgraph-tests.yml | 2 +- CHANGELOG.md | 8 +++++--- README.md | 5 +++-- pydgraph/meta.py | 2 +- scripts/local-test.sh | 20 ++++++++++++++++++++ 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-pydgraph-tests.yml b/.github/workflows/ci-pydgraph-tests.yml index 11a6435..a8bd3f9 100644 --- a/.github/workflows/ci-pydgraph-tests.yml +++ b/.github/workflows/ci-pydgraph-tests.yml @@ -23,7 +23,7 @@ jobs: runs-on: warp-ubuntu-latest-x64-4x strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout pydgraph repo uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index cb92a52..ab09a37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [v24.2.1] 2025-07-23 +## [v24.3.0] 2025-07-23 -**_Chore_** +**Chore** - Updated generated modules following a grpc deps update -- Bump down dev dependency `grpcio-tools` to <1.66.0 to allow `grpcio` compatibility with <1.66.0 (broken in v24.0.2) (#270) +- Bump down dev dependency `grpcio-tools` to <1.66.0 to allow `grpcio` compatibility with <1.66.0 + (broken in v24.0.2) (#270). Note this change removes our forward looking support for python 3.13 + until grpcio-tools is updated to support python 3.13. ## [v24.2.0] - 2025-04-01 diff --git a/README.md b/README.md index d9b3d93..a299b28 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # pydgraph -This is the official Dgraph database client implementation for Python (Python >= v3.7), using -[gRPC][grpc]. +This is the official Dgraph database client implementation for Python versions 3.9 through 3.12, +using [gRPC][grpc]. [grpc]: https://grpc.io/ @@ -60,6 +60,7 @@ version of this client. | :------------: | :--------------: | | 21.03.x | _21.03.x_ | | 23.0.x+ | _23.0.x_ | +| 24.0.x+ | _24.0.x_ | ## Quickstart diff --git a/pydgraph/meta.py b/pydgraph/meta.py index 812302c..5336ef2 100644 --- a/pydgraph/meta.py +++ b/pydgraph/meta.py @@ -3,4 +3,4 @@ """Metadata about this package.""" -VERSION = "24.2.1" +VERSION = "24.3.0" diff --git a/scripts/local-test.sh b/scripts/local-test.sh index c683070..7b647c3 100755 --- a/scripts/local-test.sh +++ b/scripts/local-test.sh @@ -33,6 +33,24 @@ function stopCluster() { DockerCompose down -t 5 } +function displayDgraphVersion() { + python3 -c " +import sys +sys.path.insert(0, '.') +from pydgraph.client_stub import DgraphClientStub +from pydgraph.client import DgraphClient + +try: + client_stub = DgraphClientStub('${TEST_SERVER_ADDR}') + client = DgraphClient(client_stub) + version = client.check_version() + print(f'Dgraph server version: {version}') + client.close() +except Exception as e: + print(f'Failed to get Dgraph version: {e}') +" +} + readonly SRCDIR=$(readlink -f "${BASH_SOURCE[0]%/*}") # Run cluster and tests @@ -43,6 +61,8 @@ alphaGrpcPort=$(DockerCompose port alpha1 9080 | awk -F: '{print $2}') popd || exit export TEST_SERVER_ADDR="localhost:${alphaGrpcPort}" echo "Using TEST_SERVER_ADDR=${TEST_SERVER_ADDR}" +displayDgraphVersion + if [[ $# -eq 0 ]]; then # No arguments provided, run all tests pytest From 6c57391b1abbe4fa513e2b55c9327528f012b4aa Mon Sep 17 00:00:00 2001 From: Joseph Wang Date: Thu, 24 Jul 2025 21:42:13 -0700 Subject: [PATCH 3/3] Readd support for Python 3.13, modify CI check --- .github/workflows/ci-pydgraph-tests.yml | 4 +++- CHANGELOG.md | 3 +-- README.md | 8 ++++++-- pyproject.toml | 13 ++++++++++--- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-pydgraph-tests.yml b/.github/workflows/ci-pydgraph-tests.yml index a8bd3f9..b22c174 100644 --- a/.github/workflows/ci-pydgraph-tests.yml +++ b/.github/workflows/ci-pydgraph-tests.yml @@ -23,7 +23,7 @@ jobs: runs-on: warp-ubuntu-latest-x64-4x strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Checkout pydgraph repo uses: actions/checkout@v4 @@ -55,6 +55,8 @@ jobs: python -m pip install --upgrade pip python -m pip install .[dev] - name: Verify that updated protobufs are checked in + if: matrix.python-version != '3.13' + # Python 3.13 uses grpcio-tools >= 1.66.2, which generates backwards incompatible source files run: | cd pydgraph python scripts/protogen.py diff --git a/CHANGELOG.md b/CHANGELOG.md index ab09a37..eaad110 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,8 +11,7 @@ adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - Updated generated modules following a grpc deps update - Bump down dev dependency `grpcio-tools` to <1.66.0 to allow `grpcio` compatibility with <1.66.0 - (broken in v24.0.2) (#270). Note this change removes our forward looking support for python 3.13 - until grpcio-tools is updated to support python 3.13. + (broken in v24.0.2) (#270). ## [v24.2.0] - 2025-04-01 diff --git a/README.md b/README.md index a299b28..d05168c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # pydgraph -This is the official Dgraph database client implementation for Python versions 3.9 through 3.12, -using [gRPC][grpc]. +This is the official Dgraph database client implementation for Python (Python >= v3.7), using +[gRPC][grpc]. [grpc]: https://grpc.io/ @@ -607,6 +607,10 @@ source files generated by Protocol Buffer tools. To do that, install the python scripts/protogen.py ``` +**NOTE:** `grpcio-tools` >= 1.66.0 will generate backwards-incompatible source files. To maintain +compatibility with older versions of `grpcio`, you should only commit regenerated source files from +Python <3.13 (which is compatible with `grpcio-tools` < 1.66.0). + ### Running tests To run the tests in your local machine, run: diff --git a/pyproject.toml b/pyproject.toml index f39a31f..8b93a85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ classifiers = [ 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', ] dependencies = ["grpcio>=1.56.0,<2.0.0", "protobuf>=4.23.0,<7.0.0"] dynamic = ["version"] @@ -29,9 +30,15 @@ dynamic = ["version"] version = { attr = "pydgraph.meta.VERSION" } [project.optional-dependencies] -# grpcio-tools 1.66.0 breaks compatibility with grpcio <1.66.0 -# but does not change the generated gRPC output for pydgraph -dev = ["build>=1.2.2.post1", "grpcio-tools>=1.65.0,<1.66.0", "pytest>=8.3.3"] +dev = [ + "build>=1.2.2.post1", + # grpcio-tools >= 1.66.0 breaks compatibility with grpcio <1.66.0 + # but does not currently change the generated gRPC output for pydgraph + "grpcio-tools>=1.65.0,<1.66.0; python_version<'3.13'", + # Python 3.13 requires grpcio-tools >=1.66.2 + "grpcio-tools>=1.66.2; python_version>='3.13'", + "pytest>=8.3.3", +] [project.urls] "Homepage" = "https://github.com/hypermodeinc/pydgraph"