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
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
check-runner:
npx tsc --noEmit
npx eslint
npx prettier --check src index.ts

format:
npx prettier --write \
src index.ts eslint.config.mjs tests \
impls/node \
impls/node-protocolv2

uv run --directory impls/python ruff format .

check-node-v1:
cd impls/node && \
npm ci && \
npx tsc --noEmit && \
npx eslint && \
npx prettier --check .

check-node-v2:
cd impls/node-protocolv2 && \
npm ci && \
npx tsc --noEmit && \
npx eslint && \
npx prettier --check .

check-python:
uv run --directory impls/python pyright .

schema.json:
npm run dump

codegen-python: schema.json
cd impls/python; \
./generate_client.sh
2 changes: 1 addition & 1 deletion impls/python/client.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ COPY src src
RUN uv sync

# bash is required for "time" in python:3.11-slim-bookworm
CMD ["bash", "-c", "time timeout 120 uv run python -u -m river_python_test.client --log-cli-level=debug"]
CMD ["bash", "-c", "time timeout 120 uv run python -u -m testservice.client --log-cli-level=debug"]
43 changes: 39 additions & 4 deletions impls/python/generate_client.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,49 @@
#!/usr/bin/env bash

set -ex

REPO_ROOT_DIR="$(git rev-parse --show-toplevel)"

cd "${REPO_ROOT_DIR}/impls/python"

rm -rf \
src/river_python_test/protos/*pb2* \
src/river_python_test/protos/service_river.py \
|| true
git clean -fdx src/river_python_test/protos/ || true

mkdir -p src/river_python_test/protos

uv run python -m grpc_tools.protoc \
--proto_path=../../protos \
--proto_path="${REPO_ROOT_DIR}/protos" \
--python_out=./src \
--mypy_out=./src \
--grpc_python_out=./src \
--mypy_grpc_out=./src \
../../protos/river_python_test/protos/service.proto
"${REPO_ROOT_DIR}/protos/testservice/protos/service.proto"

uv run python -m replit_river.codegen \
server \
--module testservice.protos \
--output ./src/testservice/protos \
"${REPO_ROOT_DIR}/protos/testservice/protos/service.proto"

uv run python -m replit_river.codegen \
client \
--output ./src/testservice/protos \
--client-name TestCient \
"${REPO_ROOT_DIR}/schema.json"

"${REPO_ROOT_DIR}/scripts/patch-grpc.sh" "$(pwd)"

if ! uv run ruff check --fix; then
uv run ruff check --add-noqa
fi

uv run ruff format

git add src/testservice/protos

uv run python -m replit_river.codegen server --output ./src/river_python_test/protos ./src/river_python_test/protos/service.proto
uv run python -m replit_river.codegen client --output ./src/river_python_test/protos/client_schema.py --client-name TestCient ../../schema.json
uv run pyright .

echo "Completed"
4 changes: 2 additions & 2 deletions impls/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ description = "River toolkit for Python"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"replit-river==0.8.1",
"replit-river==0.16.7",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/river_python_test"]
packages = ["src/testservice"]

[dependency-groups]
dev = [
Expand Down
2 changes: 1 addition & 1 deletion impls/python/server.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ COPY src src
RUN uv sync

# bash is required for "time" in python:3.11-slim-bookworm
CMD ["bash", "-c", "time timeout 120 uv run python -u -m river_python_test.server --log-cli-level=debug"]
CMD ["bash", "-c", "time timeout 120 uv run python -u -m testservice.server --log-cli-level=debug"]
Empty file.
Empty file.
208 changes: 0 additions & 208 deletions impls/python/src/river_python_test/protos/client_schema.py

This file was deleted.

45 changes: 0 additions & 45 deletions impls/python/src/river_python_test/protos/service.proto

This file was deleted.

Loading