Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions .github/workflows/ci-pydgraph-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pydgraph/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

"""Metadata about this package."""

VERSION = "24.2.1"
VERSION = "24.3.0"
12 changes: 1 addition & 11 deletions pydgraph/proto/api_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions pydgraph/proto/api_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
)


Expand Down
11 changes: 9 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
9 changes: 9 additions & 0 deletions scripts/protogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Expand Down
Loading