diff --git a/.github/workflows/ci-pydgraph-tests.yml b/.github/workflows/ci-pydgraph-tests.yml index 11a6435..6d2af1b 100644 --- a/.github/workflows/ci-pydgraph-tests.yml +++ b/.github/workflows/ci-pydgraph-tests.yml @@ -31,20 +31,6 @@ jobs: path: pydgraph repository: hypermodeinc/pydgraph ref: ${{ github.ref }} - - name: Checkout Dgraph repo # needed for acl tests - uses: actions/checkout@v4 - with: - path: dgraph - repository: hypermodeinc/dgraph - ref: main - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: dgraph/go.mod - - name: Build dgraph binary - run: cd dgraph && make docker-image # also builds dgraph binary - - name: Move dgraph binary to gopath - run: cd dgraph && mv dgraph/dgraph ~/go/bin/dgraph - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: @@ -55,9 +41,25 @@ 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.9' || matrix.python-version == '3.10' || + matrix.python-version == '3.11' || matrix.python-version == '3.12' }} # Skip for Python 3.13+ due to grpcio-tools compatibility run: | cd pydgraph python scripts/protogen.py git diff --exit-code -- . + - name: Checkout Dgraph repo # needed for acl tests + uses: actions/checkout@v4 + with: + path: dgraph + repository: hypermodeinc/dgraph + ref: main + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: dgraph/go.mod + - name: Build dgraph binary + run: cd dgraph && make docker-image # also builds dgraph binary + - name: Move dgraph binary to gopath + run: cd dgraph && mv dgraph/dgraph ~/go/bin/dgraph - name: Run tests run: cd pydgraph && DGRAPH_IMAGE_TAG=local bash scripts/local-test.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index ee7f7be..1b8f50e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,17 @@ 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.3.0] - 2025-07-29 + +**Chore** + +- Bumped minimum grpcio version to 1.65.0 +- Pinned the grpcio-tools version to 1.65.x +- Updated generated modules following a grpc deps update + ## [v24.2.1] 2025-04-02 -**_Chore_** +**Chore** - Updated generated modules following a grpc deps update diff --git a/README.md b/README.md index d9b3d93..708025f 100644 --- a/README.md +++ b/README.md @@ -596,6 +596,8 @@ To build and install pydgraph locally, run pip install -e ".[dev]" ``` +#### Regenerating protobufs + If you have made changes to the `pydgraph/proto/api.proto` file, you need need to regenerate the source files generated by Protocol Buffer tools. To do that, install the [grpcio-tools][grpcio-tools] library and then run the following command: @@ -606,6 +608,28 @@ source files generated by Protocol Buffer tools. To do that, install the python scripts/protogen.py ``` +**Important**: This project uses grpcio-tools 1.65.x to ensure compatibility with the minimum +supported grpcio version (1.65.0). This version generates code that issues warnings (not errors) for +users with older grpcio versions, providing a graceful upgrade path. It also uses protobuf 5.x which +eliminates Python 3.12+ deprecation warnings. The dev dependencies in `pyproject.toml` are pinned to +the correct version (grpcio-tools 1.65.x) + +If you are using python version 3.13 or higher, an error will be raised if you try to run +`scripts/protogen.py`. This is to prevent generating protobufs that are incompatible with older +grpcio-tools versions. + +#### grpcio 1.65.0 is the minimum version + +Older grpcio versions have practical limitations: + +- **Compilation failures**: grpcio versions older than ~1.60.0 fail to compile from source on modern + systems (macOS with recent Xcode, newer Linux distributions) due to C++ compiler compatibility + issues and outdated build configurations. +- **No pre-built wheels**: PyPI doesn't provide pre-built wheels for very old grpcio versions on + modern Python versions (3.11+), forcing compilation from source. +- **Build tool incompatibility**: The build process for older grpcio versions uses deprecated + compiler flags and build patterns that modern toolchains reject. + ### Running tests To run the tests in your local machine, run: 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/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..0ff5774 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,14 +22,21 @@ classifiers = [ 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', ] -dependencies = ["grpcio>=1.56.0,<2.0.0", "protobuf>=4.23.0,<7.0.0"] +dependencies = ["grpcio>=1.65.0,<2.0.0", "protobuf>=4.23.0,<7.0.0"] dynamic = ["version"] [tool.setuptools.dynamic] version = { attr = "pydgraph.meta.VERSION" } [project.optional-dependencies] -dev = ["build>=1.2.2.post1", "grpcio-tools>=1.68.0", "pytest>=8.3.3"] +dev = [ + "build>=1.2.2.post1", + "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" diff --git a/scripts/protogen.py b/scripts/protogen.py index 7ca9cd6..1592e9a 100644 --- a/scripts/protogen.py +++ b/scripts/protogen.py @@ -4,9 +4,18 @@ """Runs protoc with the gRPC plugin to generate messages and gRPC stubs.""" import os +import sys from grpc_tools import protoc +# Check Python version compatibility +if sys.version_info >= (3, 13): + print("ERROR: Python 3.13+ requires grpcio-tools >=1.66.2, which generates") + print("protobufs that are incompatible with older grpcio-tools versions.") + print("Please use Python 3.12 or lower to generate compatible protobufs.") + print("Exiting without generating protobufs.") + sys.exit(1) + dirpath = os.path.dirname(os.path.realpath(__file__)) protopath = os.path.realpath(os.path.join(dirpath, "../pydgraph/proto"))