Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions python/docs/Makefile
Original file line number Diff line number Diff line change
@@ -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)
159 changes: 159 additions & 0 deletions python/docs/api.rst
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions python/docs/conf.py
Original file line number Diff line number Diff line change
@@ -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"]
37 changes: 37 additions & 0 deletions python/docs/index.rst
Original file line number Diff line number Diff line change
@@ -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`
5 changes: 5 additions & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down