You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Flatten CopilotClient options + drop unused SessionConfig TypedDicts
Make the Python public API idiomatically Pythonic, matching the
conventions used by ``openai``, ``anthropic``, ``httpx``, etc.
**CopilotClient: flat kw-only ctor params**
The ``CopilotClientOptions`` dataclass was a port of the TS / .NET
``CopilotClientOptions`` interface and is not how a Python API client is
typically configured. Python users expect ``CopilotClient(connection=...,
log_level=..., github_token=...)`` rather than
``CopilotClient(CopilotClientOptions(connection=..., log_level=...,
github_token=...))``.
Changes:
- All 12 options previously on ``CopilotClientOptions`` are now kw-only
parameters on ``CopilotClient.__init__``: ``connection``,
``working_directory``, ``log_level``, ``env``, ``github_token``,
``base_directory``, ``use_logged_in_user``, ``telemetry``,
``session_fs``, ``session_idle_timeout_seconds``,
``enable_remote_sessions``, ``on_list_models``.
- ``CopilotClientOptions`` is renamed to ``_CopilotClientOptions`` and is
now an implementation detail used only internally to carry the resolved
options around. The public ``__all__`` no longer exports it.
- IDE autocomplete on ``CopilotClient(`` now lists every option directly
with its type, default, and docstring. Pyright / ty catch unknown
kwargs at the call site.
**Drop vestigial SessionConfig / ResumeSessionConfig / SessionConfigBase**
These TypedDicts mirrored the TS / .NET ``SessionConfig`` interfaces but
were never used anywhere in Python — ``create_session()`` and
``resume_session()`` already take flat kw-only parameters (the idiomatic
form). The TypedDicts were just unreferenced documentation noise.
Updates:
- README, all docs Python snippets, all 25 ``test/scenarios/**/python/main.py``
fixtures, every E2E test, every unit test now use the new flat ctor.
- The test class ``TestSubprocessOptions`` (E2E) and the unit-style
``test_telemetry_config_in_subprocess_config`` test exercised the
``CopilotClientOptions`` dataclass shape itself; they're deleted since
Python's type system already enforces ctor-kwarg correctness.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
-`connection` (RuntimeConnection | None): How to reach the runtime. Use
154
152
`RuntimeConnection.for_stdio(...)`, `RuntimeConnection.for_tcp(...)`, or
@@ -161,6 +159,7 @@ CopilotClient(CopilotClientOptions(...)) # customise via options
161
159
-`use_logged_in_user` (bool | None): Whether to use logged-in user for authentication (default: True, but False when `github_token` is provided).
162
160
-`telemetry` (dict | None): OpenTelemetry configuration for the CLI process. Providing this enables telemetry — no separate flag needed. See [Telemetry](#telemetry) below.
163
161
-`enable_remote_sessions` (bool): Enable remote/cloud session support (default: False).
162
+
-`on_list_models` (callable | None): Custom handler for `list_models()`. When provided, the handler is called instead of querying the runtime.
164
163
165
164
**RuntimeConnection variants:**
166
165
@@ -531,13 +530,13 @@ async with await client.create_session(
531
530
The SDK supports OpenTelemetry for distributed tracing. Provide a `telemetry` config to enable trace export and automatic W3C Trace Context propagation.
532
531
533
532
```python
534
-
from copilot import CopilotClient, CopilotClientOptions
0 commit comments