Skip to content

Commit 1f98743

Browse files
committed
Remove support for protobuf < 4
1 parent 71cf73b commit 1f98743

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+12
-3673
lines changed

codegen/Dockerfile.proto_v3

Lines changed: 0 additions & 24 deletions
This file was deleted.

codegen/Dockerfile.proto_v4plus

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ RUN pip install grpcio-tools==1.60 \
1414
COPY docker.generate-proto.sh /app/
1515
RUN chmod +x /app/docker.generate-proto.sh
1616

17-
ENTRYPOINT ["./docker.generate-proto.sh", "/app/src", "protobuf_v4plus"]
17+
ENTRYPOINT ["./docker.generate-proto.sh", "/app/src"]

codegen/docker.generate-proto.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
set -euxo pipefail
66

77
OUTPUT_DIR_BASE="${1:-}"
8-
OUTPUT_SUBMODULE_DIR="${2:-}"
98

10-
if [ -z "${OUTPUT_DIR_BASE}" ] || [ -z "${OUTPUT_SUBMODULE_DIR}" ]; then
11-
echo "Usage: $0 <output_src_dir> <output_submodule_dir>"
9+
if [ -z "${OUTPUT_DIR_BASE}" ]; then
10+
echo "Usage: $0 <output_src_dir>"
1211
exit 1
1312
fi
1413

15-
mkdir -p "${OUTPUT_DIR_BASE}/neptune_api/proto/$OUTPUT_SUBMODULE_DIR"
14+
mkdir -p "${OUTPUT_DIR_BASE}/neptune_api/proto"
1615

1716
python -m grpc_tools.protoc \
18-
--python_out="${OUTPUT_DIR_BASE}/neptune_api/proto/$OUTPUT_SUBMODULE_DIR" \
19-
--mypy_out="${OUTPUT_DIR_BASE}/neptune_api/proto/$OUTPUT_SUBMODULE_DIR" \
17+
--python_out="${OUTPUT_DIR_BASE}/neptune_api/proto" \
18+
--mypy_out="${OUTPUT_DIR_BASE}/neptune_api/proto" \
2019
--proto_path="./proto/" \
2120
"./proto/google_rpc/"*".proto" \
2221
"./proto/neptune_pb/ingest/v1/"*".proto" \
@@ -26,7 +25,7 @@ python -m grpc_tools.protoc \
2625
# Note that we're passing the protoc-path argument to protol, which makes sure
2726
# it's using the same protoc as above, instead of a system-wide installation.
2827
protol --create-package --in-place \
29-
--python-out "${OUTPUT_DIR_BASE}/neptune_api/proto/$OUTPUT_SUBMODULE_DIR" \
28+
--python-out "${OUTPUT_DIR_BASE}/neptune_api/proto" \
3029
protoc \
3130
--protoc-path="python -m grpc_tools.protoc" \
3231
--proto-path "./proto" \

codegen/generate-proto.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ cd "$script_dir"
1313

1414
src_dir="$script_dir/../src/"
1515

16-
docker build -t neptune-api-gen-proto_v3 -f Dockerfile.proto_v3 .
17-
docker run --rm \
18-
-v "$script_dir/proto":"/app/proto" \
19-
-v "$src_dir":"/app/src" \
20-
neptune-api-gen-proto_v3
21-
2216
docker build -t neptune-api-gen-proto_v4plus -f Dockerfile.proto_v4plus .
2317
docker run --rm \
2418
-v "$script_dir/proto":"/app/proto" \

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ httpx = { version = ">=0.15.4,<0.28.2", extras = ["http2"] }
1414
attrs = ">=21.3.0"
1515
python-dateutil = "^2.8.0"
1616
PyJWT = "^2.0.0"
17-
protobuf = ">=3.19.6,<7"
17+
protobuf = ">=4.21.1,<7"
1818

1919
[tool.poetry]
2020
name = "neptune-api"

src/neptune_api/proto/__init__.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +0,0 @@
1-
import importlib.metadata
2-
import sys
3-
4-
PROTOBUF_VERSION = importlib.metadata.version("protobuf").split('.')
5-
6-
if PROTOBUF_VERSION[0] == '3':
7-
target_module = "protobuf_v3"
8-
else:
9-
target_module = "protobuf_v4plus"
10-
11-
sys.modules["neptune_api.proto"] = importlib.import_module(f"neptune_api.proto.{target_module}")

src/neptune_api/proto/__init__.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
from .protobuf_v3 import google_rpc, neptune_pb
1+
from . import google_rpc
2+
from . import neptune_pb
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)