Skip to content

Commit 4e99250

Browse files
committed
fix: make generated Python package private
1 parent 72de60f commit 4e99250

24 files changed

Lines changed: 94 additions & 77 deletions

‎.gitattributes‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ java/**/*.java text eol=lf
66
# Generated files — keep LF line endings so codegen output is deterministic across platforms.
77
nodejs/src/generated/* eol=lf linguist-generated=true
88
dotnet/src/Generated/* eol=lf linguist-generated=true
9-
python/copilot/generated/* eol=lf linguist-generated=true
9+
python/copilot/_generated/* eol=lf linguist-generated=true
1010
go/zsession_events.go eol=lf linguist-generated=true
1111
go/zsession_encoding.go eol=lf linguist-generated=true
1212
go/rpc/zrpc.go eol=lf linguist-generated=true

‎.github/workflows/codegen-check.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- 'scripts/codegen/**'
1111
- 'nodejs/src/generated/**'
1212
- 'dotnet/src/Generated/**'
13-
- 'python/copilot/generated/**'
13+
- 'python/copilot/_generated/**'
1414
- 'go/generated_*.go'
1515
- 'go/rpc/**'
1616
- 'rust/src/generated/**'

‎python/copilot/__init__.py‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@
1111

1212
# Register the public ``copilot.session_events`` namespace.
1313
from . import session_events as session_events # noqa: F401
14+
from ._generated.rpc import (
15+
CurrentToolMetadata,
16+
GitHubTelemetryClientInfo,
17+
GitHubTelemetryEvent,
18+
GitHubTelemetryNotification,
19+
ModelBillingTokenPrices,
20+
ModelBillingTokenPricesLongContext,
21+
)
22+
from ._generated.session_events import (
23+
PermissionRequest,
24+
SessionEvent,
25+
SessionEventType,
26+
)
1427
from ._mode import (
1528
BUILTIN_TOOLS_ISOLATED,
1629
CopilotClientMode,
@@ -78,19 +91,6 @@
7891
CopilotWebSocketHandler,
7992
LlmInferenceHeaders,
8093
)
81-
from .generated.rpc import (
82-
CurrentToolMetadata,
83-
GitHubTelemetryClientInfo,
84-
GitHubTelemetryEvent,
85-
GitHubTelemetryNotification,
86-
ModelBillingTokenPrices,
87-
ModelBillingTokenPricesLongContext,
88-
)
89-
from .generated.session_events import (
90-
PermissionRequest,
91-
SessionEvent,
92-
SessionEventType,
93-
)
9494
from .session import (
9595
AgentStopHandler,
9696
AgentStopHookInput,
File renamed without changes.

‎python/copilot/canvas.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from dataclasses import dataclass
2020
from typing import Any
2121

22-
from .generated.rpc import (
22+
from ._generated.rpc import (
2323
CanvasAction,
2424
CanvasHostContext,
2525
CanvasHostContextCapabilities,

‎python/copilot/client.py‎

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,26 @@
3333

3434
from ._diagnostics import log_timing
3535
from ._ffi_runtime_host import FfiRuntimeHost
36+
from ._generated.rpc import (
37+
ClientGlobalApiHandlers,
38+
ClientSessionApiHandlers,
39+
GitHubTelemetryNotification,
40+
ModelBillingTokenPrices,
41+
ModelBillingTokenPricesLongContext, # noqa: F401
42+
OpenCanvasInstance,
43+
RemoteSessionMode,
44+
ServerRpc,
45+
_ConnectResult,
46+
_HookInvokeRequest,
47+
_HookInvokeResponse,
48+
from_datetime,
49+
register_client_global_api_handlers,
50+
register_client_session_api_handlers,
51+
)
52+
from ._generated.session_events import (
53+
SessionEvent,
54+
session_event_from_dict,
55+
)
3656
from ._jsonrpc import JsonRpcClient, JsonRpcError, ProcessExitedError
3757
from ._mode import (
3858
CopilotClientMode,
@@ -64,26 +84,6 @@
6484
ExtensionInfo,
6585
)
6686
from .copilot_request_handler import CopilotRequestHandler, create_copilot_request_adapter
67-
from .generated.rpc import (
68-
ClientGlobalApiHandlers,
69-
ClientSessionApiHandlers,
70-
GitHubTelemetryNotification,
71-
ModelBillingTokenPrices,
72-
ModelBillingTokenPricesLongContext, # noqa: F401
73-
OpenCanvasInstance,
74-
RemoteSessionMode,
75-
ServerRpc,
76-
_ConnectResult,
77-
_HookInvokeRequest,
78-
_HookInvokeResponse,
79-
from_datetime,
80-
register_client_global_api_handlers,
81-
register_client_session_api_handlers,
82-
)
83-
from .generated.session_events import (
84-
SessionEvent,
85-
session_event_from_dict,
86-
)
8787
from .session import (
8888
AutoModeSwitchHandler,
8989
BearerTokenProvider,
@@ -4356,7 +4356,7 @@ async def _apply_post_create_options_patch(
43564356
If the patch is rejected, tear the session down so empty-mode callers
43574357
never end up with a permissive session.
43584358
"""
4359-
from .generated.rpc import SessionInstalledPlugin, SessionUpdateOptionsParams
4359+
from ._generated.rpc import SessionInstalledPlugin, SessionUpdateOptionsParams
43604360

43614361
patch = _post_create_options_patch(
43624362
mode,

‎python/copilot/copilot_request_handler.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
transparent forwarding connection via the ``websockets`` library.
1616
1717
:func:`create_copilot_request_adapter` converts a handler into the generated
18-
:class:`~copilot.generated.rpc.LlmInferenceHandler` shape so the RPC dispatcher
18+
:class:`~copilot.rpc.LlmInferenceHandler` shape so the RPC dispatcher
1919
can route inbound ``httpRequestStart`` / ``httpRequestChunk`` frames through it.
2020
"""
2121

@@ -27,7 +27,7 @@
2727
from dataclasses import dataclass, field
2828
from typing import TYPE_CHECKING, Any
2929

30-
from .generated.rpc import (
30+
from ._generated.rpc import (
3131
LlmInferenceHTTPRequestChunkRequest,
3232
LlmInferenceHTTPRequestChunkResult,
3333
LlmInferenceHTTPRequestStartRequest,

‎python/copilot/rpc.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
These types are auto-generated from the Copilot CLI protocol schemas. This
44
module is the stable public access point so callers can write
55
``copilot.rpc.SessionUpdateOptionsParams`` without depending on the internal
6-
``copilot.generated`` package layout.
6+
``copilot._generated`` package layout.
77
"""
88

9-
from .generated.rpc import * # noqa: F401, F403
10-
from .generated.rpc import (
9+
from ._generated.rpc import * # noqa: F401, F403
10+
from ._generated.rpc import (
1111
SessionFsReaddirWithTypesEntryType as SessionFSReaddirWithTypesEntryType, # noqa: F401
1212
)
13-
from .generated.rpc import __all__ # noqa: F401
13+
from ._generated.rpc import __all__ # noqa: F401

0 commit comments

Comments
 (0)