[Python] Declare various modules as private#884
Open
brettcannon wants to merge 2 commits intogithub:mainfrom
Open
[Python] Declare various modules as private#884brettcannon wants to merge 2 commits intogithub:mainfrom
brettcannon wants to merge 2 commits intogithub:mainfrom
Conversation
- `telemetry` - `jsonrpc` - `sdk_protocol_version`
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Python SDK to treat several previously-public modules as internal/private by moving them behind underscored module names, and updates codegen + tests accordingly.
Changes:
- Rename/move Python modules to private equivalents:
jsonrpc→_jsonrpc,telemetry→_telemetry,sdk_protocol_version→_sdk_protocol_version. - Update Python SDK imports and unit tests to use the new private module paths.
- Update Python RPC type codegen and the Node protocol-version generator to reference the new Python filename.
Reviewed changes
Copilot reviewed 6 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| scripts/codegen/python.ts | Updates generated Python RPC typing imports to reference .._jsonrpc. |
| python/test_telemetry.py | Adjusts telemetry tests to import from copilot._telemetry. |
| python/test_jsonrpc.py | Adjusts JSON-RPC client tests to import from copilot._jsonrpc. |
| python/copilot/session.py | Switches internal imports to _jsonrpc and _telemetry. |
| python/copilot/generated/rpc.py | Updates generated TYPE_CHECKING import to .._jsonrpc. |
| python/copilot/client.py | Switches internal imports to _jsonrpc, _telemetry, _sdk_protocol_version. |
| python/copilot/_telemetry.py | Adds private telemetry helper module (trace context injection/extraction). |
| python/copilot/_sdk_protocol_version.py | Adds private generated protocol version module. |
| python/copilot/_jsonrpc.py | Adds private JSON-RPC client implementation used by the Python SDK. |
| nodejs/scripts/update-protocol-version.ts | Writes Python protocol version file to _sdk_protocol_version.py instead of the prior path. |
Comment on lines
+28
to
33
| from ._jsonrpc import JsonRpcClient, ProcessExitedError | ||
| from ._sdk_protocol_version import get_sdk_protocol_version | ||
| from ._telemetry import get_trace_context, trace_context | ||
| from .generated.rpc import ServerRpc | ||
| from .generated.session_events import PermissionRequest, session_event_from_dict | ||
| from .jsonrpc import JsonRpcClient, ProcessExitedError | ||
| from .sdk_protocol_version import get_sdk_protocol_version | ||
| from .session import CopilotSession |
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.
telemetryjsonrpcsdk_protocol_version