fix: proto descriptor collision and PyPI wheel packaging#11
Merged
Conversation
When both capiscio-sdk and capiscio-mcp are co-installed, the second proto import crashes with DescriptorPoolConflict. Fix: - Eager import of mcp_pb2 in __init__.py to win the registration race - Add try/except around AddSerializedFile with FindFileByName fallback
|
✅ Integration tests passed! capiscio-core gRPC tests working. |
There was a problem hiding this comment.
Pull request overview
Addresses interoperability and packaging issues for capiscio-mcp when co-installed with capiscio-sdk, ensuring protobuf descriptors are registered predictably and generated proto files are included in PyPI artifacts.
Changes:
- Eagerly imports MCP protobuf module on
capiscio_mcppackage import to register descriptors early. - Adds defensive descriptor registration fallback in generated
mcp_pb2.pyto avoid hard failures on duplicate registration. - Updates Hatch build config to force-include generated proto code in wheel and sdist outputs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
pyproject.toml |
Forces inclusion of generated proto directory in wheel/sdist to fix missing files in published artifacts. |
capiscio_mcp/_proto/gen/capiscio/v1/mcp_pb2.py |
Adds try/except around AddSerializedFile to tolerate descriptor collisions. |
capiscio_mcp/__init__.py |
Eagerly imports MCP proto module to register the “superset” descriptor first. |
…ge check and schema validation
|
✅ Integration tests passed! capiscio-core gRPC tests working. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Companion PR to capiscio/capiscio-sdk-python#47. Fixes the MCP side of the proto descriptor collision.
1. Proto Descriptor Pool Collision (P0-5)
When both
capiscio-mcp-pythonandcapiscio-sdkare installed, importing both causes a protobuf descriptor pool collision oncapiscio/v1/mcp.proto.Fix: Eager proto registration in
__init__.py— MCP's proto descriptors are registered first, so the SDK's lazy-load fallback finds them already registered. Addedtry/exceptaroundAddSerializedFileinmcp_pb2.pywithFindFileByNamefallback.2. PyPI Wheel Missing Proto Files (P0-4)
Same hatchling issue as the SDK — nested
capiscio/directory excluded from wheels.Fix: Added
[tool.hatch.build.targets.wheel.force-include]for the proto gen directory.Files Changed
capiscio_mcp/__init__.py— eager MCP proto import on package loadcapiscio_mcp/_proto/gen/capiscio/v1/mcp_pb2.py— try/except descriptor registrationpyproject.toml— force-include for proto gen filesRelated