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
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,16 @@ jobs:
run: cargo test --doc

python-test:
name: Python Tests
name: Python Tests (protobuf ${{ matrix.protobuf_major }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- protobuf_major: 5
protobuf_spec: "protobuf==5.27.2"
- protobuf_major: 6
protobuf_spec: "protobuf>=6.30.2,<7.0.0"

steps:
- name: Checkout repository
Expand All @@ -115,7 +123,7 @@ jobs:
working-directory: modelexpress_client/python
run: |
uv venv .venv --python 3.12
uv pip install -e ".[dev]"
uv pip install -e ".[dev]" '${{ matrix.protobuf_spec }}'

- name: Run tests
working-directory: modelexpress_client/python
Expand Down
6 changes: 5 additions & 1 deletion modelexpress_client/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ pip install modelexpress
# Editable install from source
pip install -e .

# With dev dependencies (pytest, grpcio-tools)
# With test dependencies
pip install -e ".[dev]"

# Additionally install the pinned protobuf code generator when changing p2p.proto
pip install -e ".[codegen]"
```

NIXL is expected to be supplied by the runtime environment (TRT-LLM,
Expand All @@ -27,6 +30,7 @@ or `pip install nixl-cu13` separately, matching your host CUDA toolkit.
### Requirements

- Python >= 3.10
- protobuf >= 5.27.2 and < 7
- NVIDIA GPUs with RDMA/InfiniBand support
- [NIXL](https://github.com/ai-dynamo/nixl) (NVIDIA Interconnect eXchange Library)
- A running [ModelExpress server](https://github.com/ai-dynamo/modelexpress/tree/main/modelexpress_server) (Rust gRPC service backed by Redis)
Expand Down
8 changes: 5 additions & 3 deletions modelexpress_client/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies = [
"google-crc32c>=1.5.0",
"huggingface_hub>=0.20.0",
"numpy>=1.24.0",
"protobuf>=5.27.0,<6.0.0", # protobuf 5.x compatibility
"protobuf>=5.27.2,<7.0.0",
"pydantic>=2.0.0",
"torch>=2.6.0",
"runai-model-streamer[s3,gcs,azure]; sys_platform == 'linux'",
Expand All @@ -37,13 +37,15 @@ dependencies = [

[project.optional-dependencies]
dev = [
# Use grpcio-tools<=1.66.2 for protobuf 5.x, >=1.67.0 for protobuf 6.x
"grpcio-tools>=1.60.0,<=1.66.2",
"opentelemetry-api>=1.41.1",
"opentelemetry-sdk>=1.41.1",
"pytest>=7.0.0",
"pytest-asyncio>=0.21.0",
]
codegen = [
# Keep generated Python stubs compatible with both protobuf 5 and 6.
"grpcio-tools==1.66.2",
]
otel = [
"opentelemetry-api>=1.20.0",
]
Expand Down
13 changes: 5 additions & 8 deletions modelexpress_client/python/tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
class TestProtobufCompatibility:
"""Guard against generated protobuf code drifting from the installed runtime."""

def test_p2p_pb2_gencode_matches_runtime_major_version(self):
"""Regenerate p2p_pb2.py if this fails (see pyproject.toml [dev] deps)."""
def test_p2p_pb2_gencode_supports_runtime_major_version(self):
"""Keep protobuf 5 gencode usable on supported 5.x and 6.x runtimes."""
import modelexpress.p2p_pb2 as pb2

with open(pb2.__file__) as f:
Expand All @@ -29,12 +29,9 @@ def test_p2p_pb2_gencode_matches_runtime_major_version(self):
assert m, "Could not parse gencode version from p2p_pb2.py"
gencode_major = int(m.group(1))
runtime_major = int(_pb_version.split(".")[0])
assert gencode_major == runtime_major, (
f"p2p_pb2.py was generated with protobuf {gencode_major}.x "
f"but runtime is {runtime_major}.x - regenerate with: "
f"python -m grpc_tools.protoc -I../../modelexpress_common/proto "
f"--python_out=modelexpress --grpc_python_out=modelexpress "
f"../../modelexpress_common/proto/p2p.proto"
assert gencode_major == 5, "checked-in bindings must remain protobuf 5 gencode"
assert runtime_major in {5, 6}, (
f"unsupported protobuf runtime major: {runtime_major}"
)

def test_publish_request_is_readable_by_0_4_schema(self):
Expand Down
10 changes: 6 additions & 4 deletions modelexpress_client/python/uv.lock

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

Loading