Skip to content

fix: proto descriptor collision and PyPI wheel packaging#11

Merged
beonde merged 2 commits intomainfrom
fix/proto-descriptor-collision
Mar 27, 2026
Merged

fix: proto descriptor collision and PyPI wheel packaging#11
beonde merged 2 commits intomainfrom
fix/proto-descriptor-collision

Conversation

@beonde
Copy link
Copy Markdown
Member

@beonde beonde commented Mar 27, 2026

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-python and capiscio-sdk are installed, importing both causes a protobuf descriptor pool collision on capiscio/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. Added try/except around AddSerializedFile in mcp_pb2.py with FindFileByName fallback.

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 load
  • capiscio_mcp/_proto/gen/capiscio/v1/mcp_pb2.py — try/except descriptor registration
  • pyproject.toml — force-include for proto gen files

Related

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
Copilot AI review requested due to automatic review settings March 27, 2026 03:11
@github-actions
Copy link
Copy Markdown

✅ Integration tests passed! capiscio-core gRPC tests working.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_mcp package import to register descriptors early.
  • Adds defensive descriptor registration fallback in generated mcp_pb2.py to 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.

@github-actions
Copy link
Copy Markdown

✅ Integration tests passed! capiscio-core gRPC tests working.

@beonde beonde merged commit 421ab37 into main Mar 27, 2026
10 checks passed
@beonde beonde deleted the fix/proto-descriptor-collision branch March 27, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants