Context
PR #639 작업 중 `inbound.proto` 갱신 후 `grpc_tools.protoc` 으로 stub regen 시도. `packages/ai-server/src/grpc/README.md` 의 명령어:
```bash
python3 -m grpc_tools.protoc \
--proto_path=src/grpc/proto \
--python_out=src/grpc/proto/inbound \
--grpc_python_out=src/grpc/proto/inbound \
src/grpc/proto/inbound/inbound.proto
```
→ `src/grpc/proto/inbound/inbound/` 라는 nested 디렉토리에 `inbound_pb2.py` + `inbound_pb2_grpc.py` 가 생성됨. `from inbound import inbound_pb2 as inbound_dot_inbound__pb2` 형태의 wrong import path 도 만듬.
원인: `proto_path` 가 `src/grpc/proto` 라 protoc 가 `inbound/inbound.proto` 로 해석 → `inbound/` 가 패키지 prefix 가 됨.
Workaround used in PR #639
- nested 파일들을 원래 위치로 mv + nested 디렉토리 삭제
- `from . import inbound_pb2 as inbound__pb2` 로 import line 수동 복구
Proposed fix
README 의 명령어를 `--proto_path=src/grpc/proto/inbound` 로 변경. outbound.proto 도 동일하게 `--proto_path=src/grpc/proto/outbound`. 또는 Makefile / justfile recipe 로 표준화.
```bash
python3 -m grpc_tools.protoc \
--proto_path=src/grpc/proto/inbound \
--python_out=src/grpc/proto/inbound \
--grpc_python_out=src/grpc/proto/inbound \
src/grpc/proto/inbound/inbound.proto
```
(grpc 가 from . import 를 자동 생성하지 않으면 sed 로 `import inbound_pb2 as inbound__pb2` → `from . import inbound_pb2 as inbound__pb2` post-process 필요할 수도)
Acceptance
- README 명령어 그대로 실행 시 wrong dir 생성 없음
- import path 가 `from . import inbound_pb2 as inbound__pb2` 그대로 유지
References: PR #639
Context
PR #639 작업 중 `inbound.proto` 갱신 후 `grpc_tools.protoc` 으로 stub regen 시도. `packages/ai-server/src/grpc/README.md` 의 명령어:
```bash
python3 -m grpc_tools.protoc \
--proto_path=src/grpc/proto \
--python_out=src/grpc/proto/inbound \
--grpc_python_out=src/grpc/proto/inbound \
src/grpc/proto/inbound/inbound.proto
```
→ `src/grpc/proto/inbound/inbound/` 라는 nested 디렉토리에 `inbound_pb2.py` + `inbound_pb2_grpc.py` 가 생성됨. `from inbound import inbound_pb2 as inbound_dot_inbound__pb2` 형태의 wrong import path 도 만듬.
원인: `proto_path` 가 `src/grpc/proto` 라 protoc 가 `inbound/inbound.proto` 로 해석 → `inbound/` 가 패키지 prefix 가 됨.
Workaround used in PR #639
Proposed fix
README 의 명령어를 `--proto_path=src/grpc/proto/inbound` 로 변경. outbound.proto 도 동일하게 `--proto_path=src/grpc/proto/outbound`. 또는 Makefile / justfile recipe 로 표준화.
```bash
python3 -m grpc_tools.protoc \
--proto_path=src/grpc/proto/inbound \
--python_out=src/grpc/proto/inbound \
--grpc_python_out=src/grpc/proto/inbound \
src/grpc/proto/inbound/inbound.proto
```
(grpc 가 from . import 를 자동 생성하지 않으면 sed 로 `import inbound_pb2 as inbound__pb2` → `from . import inbound_pb2 as inbound__pb2` post-process 필요할 수도)
Acceptance
References: PR #639