From 473340564222b255cc197aee8f83866e4c7d05db Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 13 Jun 2026 14:34:31 +0000 Subject: [PATCH 1/2] Initial plan From feed5f6838760b60955cead860f2ba6285ad006c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 13 Jun 2026 14:39:00 +0000 Subject: [PATCH 2/2] Add Read the Docs configuration and Sphinx setup for Python SDK - Add .readthedocs.yaml at repo root for RTD hosting - Create python/docs/ with Sphinx conf.py, index.rst, api.rst, Makefile - Add [project.optional-dependencies] docs group in pyproject.toml - Uses furo theme, autodoc, napoleon, and sphinx-autodoc-typehints Co-authored-by: edburns <75821+edburns@users.noreply.github.com> --- .readthedocs.yaml | 18 +++++ python/docs/Makefile | 14 ++++ python/docs/api.rst | 159 ++++++++++++++++++++++++++++++++++++++++++ python/docs/conf.py | 45 ++++++++++++ python/docs/index.rst | 37 ++++++++++ python/pyproject.toml | 5 ++ 6 files changed, 278 insertions(+) create mode 100644 .readthedocs.yaml create mode 100644 python/docs/Makefile create mode 100644 python/docs/api.rst create mode 100644 python/docs/conf.py create mode 100644 python/docs/index.rst diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 000000000..dc812e878 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,18 @@ +# Read the Docs configuration file for the Python SDK. +# See https://docs.readthedocs.io/en/stable/config-file/v2.html +version: 2 + +build: + os: ubuntu-24.04 + tools: + python: "3.12" + +sphinx: + configuration: python/docs/conf.py + +python: + install: + - method: pip + path: python + extra_requirements: + - docs diff --git a/python/docs/Makefile b/python/docs/Makefile new file mode 100644 index 000000000..5c2dc9c32 --- /dev/null +++ b/python/docs/Makefile @@ -0,0 +1,14 @@ +# Minimal makefile for Sphinx documentation + +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/python/docs/api.rst b/python/docs/api.rst new file mode 100644 index 000000000..ce64b484c --- /dev/null +++ b/python/docs/api.rst @@ -0,0 +1,159 @@ +API reference +============= + +.. module:: copilot + +Client +------ + +.. autoclass:: copilot.CopilotClient + :members: + :undoc-members: + +.. autoclass:: copilot.RuntimeConnection + :members: + +.. autoclass:: copilot.StdioRuntimeConnection + :members: + +.. autoclass:: copilot.TcpRuntimeConnection + :members: + +.. autoclass:: copilot.UriRuntimeConnection + :members: + +.. autoclass:: copilot.ChildProcessRuntimeConnection + :members: + +Sessions +-------- + +.. autoclass:: copilot.CopilotSession + :members: + :undoc-members: + +.. autoclass:: copilot.SessionCapabilities + :members: + +.. autoclass:: copilot.SessionContext + :members: + +.. autoclass:: copilot.InfiniteSessionConfig + :members: + +.. autoclass:: copilot.ProviderConfig + :members: + +.. autoclass:: copilot.SystemMessageConfig + :members: + +Tools +----- + +.. autofunction:: copilot.define_tool + +.. autoclass:: copilot.Tool + :members: + +.. autoclass:: copilot.ToolInvocation + :members: + +.. autoclass:: copilot.ToolResult + :members: + +.. autoclass:: copilot.ToolBinaryResult + :members: + +.. autoclass:: copilot.ToolSet + :members: + +Modes +----- + +.. autoclass:: copilot.CopilotClientMode + :members: + :undoc-members: + +Events +------ + +.. autoclass:: copilot.SessionEvent + :members: + +.. autoclass:: copilot.SessionEventType + :members: + :undoc-members: + +.. autoclass:: copilot.SessionEventHandler + :members: + +Hooks +----- + +.. autoclass:: copilot.SessionHooks + :members: + +.. autoclass:: copilot.PreToolUseHookInput + :members: + +.. autoclass:: copilot.PreToolUseHookOutput + :members: + +.. autoclass:: copilot.PostToolUseHookInput + :members: + +.. autoclass:: copilot.PostToolUseHookOutput + :members: + +.. autoclass:: copilot.SessionStartHookInput + :members: + +.. autoclass:: copilot.SessionStartHookOutput + :members: + +.. autoclass:: copilot.SessionEndHookInput + :members: + +.. autoclass:: copilot.SessionEndHookOutput + :members: + +Canvas +------ + +.. autoclass:: copilot.CanvasDeclaration + :members: + +.. autoclass:: copilot.CanvasHandler + :members: + +.. autoclass:: copilot.CanvasAction + :members: + +MCP +--- + +.. autoclass:: copilot.MCPServerConfig + :members: + +.. autoclass:: copilot.MCPStdioServerConfig + :members: + +.. autoclass:: copilot.MCPHTTPServerConfig + :members: + +Telemetry +--------- + +.. autoclass:: copilot.TelemetryConfig + :members: + +Session filesystem +------------------ + +.. autoclass:: copilot.SessionFsProvider + :members: + +.. autoclass:: copilot.SessionFsSqliteProvider + :members: + +.. autofunction:: copilot.create_session_fs_adapter diff --git a/python/docs/conf.py b/python/docs/conf.py new file mode 100644 index 000000000..b35acf410 --- /dev/null +++ b/python/docs/conf.py @@ -0,0 +1,45 @@ +# Configuration file for the Sphinx documentation builder. +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +import importlib.metadata + +project = "GitHub Copilot SDK for Python" +copyright = "2025, GitHub" +author = "GitHub" + +try: + release = importlib.metadata.version("github-copilot-sdk") +except importlib.metadata.PackageNotFoundError: + release = "0.0.0.dev0" + +# -- General configuration --------------------------------------------------- + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", + "sphinx.ext.intersphinx", + "sphinx_autodoc_typehints", +] + +# Napoleon settings (Google/NumPy style docstrings) +napoleon_google_docstring = True +napoleon_numpy_docstring = True +napoleon_include_init_with_doc = True + +# autodoc settings +autodoc_member_order = "bysource" +autodoc_typehints = "description" +autodoc_class_signature = "separated" + +# Intersphinx mapping +intersphinx_mapping = { + "python": ("https://docs.python.org/3", None), +} + +# -- Options for HTML output ------------------------------------------------- + +html_theme = "furo" +html_title = "GitHub Copilot SDK for Python" + +# Exclude generated/internal modules from documentation +exclude_patterns = ["_build"] diff --git a/python/docs/index.rst b/python/docs/index.rst new file mode 100644 index 000000000..52d38140c --- /dev/null +++ b/python/docs/index.rst @@ -0,0 +1,37 @@ +GitHub Copilot SDK for Python +============================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents + + api + +The GitHub Copilot SDK for Python provides a JSON-RPC based client for +programmatic control of the GitHub Copilot CLI. It enables you to create +sessions, send messages, define tools, and handle events from the Copilot +agent loop. + +Quick start +----------- + +.. code-block:: python + + from copilot import CopilotClient + + async with CopilotClient() as client: + session = await client.create_session() + response = await session.send("Hello!") + +Installation +------------ + +.. code-block:: bash + + pip install github-copilot-sdk + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` diff --git a/python/pyproject.toml b/python/pyproject.toml index 596e07be2..8203e2452 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -44,6 +44,11 @@ dev = [ "httpx>=0.24.0", "opentelemetry-sdk>=1.0.0", ] +docs = [ + "sphinx>=7.0", + "sphinx-autodoc-typehints>=2.0", + "furo>=2024.0", +] telemetry = [ "opentelemetry-api>=1.0.0", ]