fix: proto descriptor collision and PyPI wheel packaging#47
Conversation
When both capiscio-sdk and capiscio-mcp are installed, they ship identical capiscio/v1/mcp_pb2.py files. The second import crashes with DescriptorPoolConflict. Fix: - Lazy-load MCP proto modules in client.py (only when MCP methods called) - Add try/except around AddSerializedFile with FindFileByName fallback
|
✅ Documentation validation passed!
|
|
✅ All checks passed! Ready for review. |
|
✅ SDK server contract tests passed (test_server_integration.py). Cross-product scenarios are validated in capiscio-e2e-tests. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Fixes protobuf descriptor pool collisions and missing generated proto stubs in built distributions so capiscio-sdk-python can coexist with capiscio-mcp-python in the same environment.
Changes:
- Lazy-load MCP protobuf modules and MCP service stub creation to avoid importing MCP protos in core flows.
- Add a descriptor registration fallback in
mcp_pb2.pyto reuse an already-registeredcapiscio/v1/mcp.proto. - Force-include generated protobuf package directories in wheel and sdist builds.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pyproject.toml | Forces inclusion of generated protobuf package directory in wheel/sdist artifacts. |
| capiscio_sdk/_rpc/gen/capiscio/v1/mcp_pb2.py | Adds try/except around descriptor registration to avoid collisions. |
| capiscio_sdk/_rpc/client.py | Makes MCP stubs/protos lazy-loaded to prevent import-time descriptor collisions. |
|
✅ Documentation validation passed!
|
|
✅ All checks passed! Ready for review. |
|
✅ SDK server contract tests passed (test_server_integration.py). Cross-product scenarios are validated in capiscio-e2e-tests. |
Summary
Fixes two related issues that prevent the SDK from working alongside capiscio-mcp-python:
1. Proto Descriptor Pool Collision (P0-5)
When both
capiscio-sdkandcapiscio-mcp-pythonare installed, importing both causes a protobuf descriptor pool collision because both registercapiscio/v1/mcp.proto.Fix: Lazy-load MCP proto modules in the SDK's RPC client — they're only imported when MCP-specific methods are actually called. Added
try/exceptaroundAddSerializedFileinmcp_pb2.pywithFindFileByNamefallback.2. PyPI Wheel Missing Proto Files (P0-4)
Hatchling excludes the nested
capiscio/directory undergen/because it looks like a separate top-level package not matching thepackages = ["capiscio_sdk"]filter.Fix: Added
[tool.hatch.build.targets.wheel.force-include]to explicitly include the proto gen directory. Verified: wheel now contains all 18 proto files.Files Changed
capiscio_sdk/_rpc/client.py— lazy-load_ensure_mcp_protos()capiscio_sdk/_rpc/gen/capiscio/v1/mcp_pb2.py— try/except descriptor registrationpyproject.toml— force-include for proto gen filesTesting