2024-05-24 13:45:23 -04:00
|
|
|
# Configuration file for the Sphinx documentation builder.
|
|
|
|
#
|
|
|
|
# For the full list of built-in configuration values, see the documentation:
|
|
|
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
|
|
|
2024-09-17 06:22:38 -07:00
|
|
|
import pydata_sphinx_theme
|
|
|
|
from sphinx.application import Sphinx
|
|
|
|
from typing import Any, Dict
|
|
|
|
from pathlib import Path
|
|
|
|
import sys
|
2024-05-24 13:45:23 -04:00
|
|
|
# -- Project information -----------------------------------------------------
|
|
|
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
|
|
|
2024-09-17 06:22:38 -07:00
|
|
|
|
2024-08-28 12:47:04 -04:00
|
|
|
project = "autogen_core"
|
2024-05-24 13:45:23 -04:00
|
|
|
copyright = "2024, Microsoft"
|
|
|
|
author = "Microsoft"
|
2024-09-17 06:22:38 -07:00
|
|
|
version = "0.2"
|
|
|
|
|
|
|
|
|
|
|
|
sys.path.append(str(Path(".").resolve()))
|
2024-05-24 13:45:23 -04:00
|
|
|
|
|
|
|
# -- General configuration ---------------------------------------------------
|
|
|
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
|
|
|
|
|
|
extensions = [
|
2024-09-17 06:22:38 -07:00
|
|
|
"sphinx.ext.napoleon",
|
2024-05-24 13:45:23 -04:00
|
|
|
"sphinx.ext.autodoc",
|
|
|
|
"sphinx.ext.autosummary",
|
2024-09-17 06:22:38 -07:00
|
|
|
"sphinx.ext.todo",
|
|
|
|
"sphinx.ext.viewcode",
|
|
|
|
"sphinx.ext.intersphinx",
|
|
|
|
"sphinx.ext.graphviz",
|
|
|
|
"sphinx_design",
|
|
|
|
"sphinx_copybutton",
|
|
|
|
"_extension.gallery_directive",
|
2024-08-06 11:37:11 -07:00
|
|
|
"myst_nb",
|
2024-10-09 14:46:43 -04:00
|
|
|
"sphinxcontrib.autodoc_pydantic"
|
2024-05-24 13:45:23 -04:00
|
|
|
]
|
2024-09-17 06:22:38 -07:00
|
|
|
suppress_warnings = ["myst.header"]
|
2024-05-24 13:45:23 -04:00
|
|
|
|
2024-08-05 12:27:03 -07:00
|
|
|
napoleon_custom_sections = [("Returns", "params_style")]
|
2024-05-24 13:45:23 -04:00
|
|
|
|
2024-09-17 06:22:38 -07:00
|
|
|
templates_path = ["_templates"]
|
2024-05-24 13:45:23 -04:00
|
|
|
|
2024-10-09 14:46:43 -04:00
|
|
|
autoclass_content = "class"
|
2024-05-24 13:45:23 -04:00
|
|
|
|
2024-08-06 11:37:11 -07:00
|
|
|
# TODO: incldue all notebooks excluding those requiring remote API access.
|
|
|
|
nb_execution_mode = "off"
|
|
|
|
|
2024-05-24 13:45:23 -04:00
|
|
|
# Guides and tutorials must succeed.
|
|
|
|
nb_execution_raise_on_error = True
|
|
|
|
nb_execution_timeout = 60
|
|
|
|
|
2024-08-07 00:49:28 -07:00
|
|
|
myst_heading_anchors = 5
|
|
|
|
|
2024-09-17 12:08:32 -04:00
|
|
|
myst_enable_extensions = [
|
|
|
|
"colon_fence",
|
|
|
|
"linkify",
|
|
|
|
"strikethrough",
|
|
|
|
]
|
|
|
|
|
2024-09-30 17:09:52 -04:00
|
|
|
html_baseurl = "/autogen/dev/"
|
2024-09-17 06:22:38 -07:00
|
|
|
|
2024-05-24 13:45:23 -04:00
|
|
|
# -- Options for HTML output -------------------------------------------------
|
|
|
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
|
|
|
2024-09-23 10:46:05 -04:00
|
|
|
html_title = "AutoGen"
|
2024-06-12 15:21:20 -04:00
|
|
|
|
2024-09-17 06:22:38 -07:00
|
|
|
html_theme = "pydata_sphinx_theme"
|
|
|
|
html_static_path = ["_static"]
|
|
|
|
html_css_files = ["custom.css"]
|
|
|
|
html_sidebars = {'packages/index': []}
|
2024-05-24 13:45:23 -04:00
|
|
|
|
2024-10-09 10:08:57 -04:00
|
|
|
html_logo = "_static/images/logo/logo.svg"
|
|
|
|
html_favicon = "_static/images/logo/favicon-512x512.png"
|
|
|
|
|
2024-05-24 13:45:23 -04:00
|
|
|
html_theme_options = {
|
2024-09-17 06:22:38 -07:00
|
|
|
|
|
|
|
"header_links_before_dropdown": 4,
|
|
|
|
"navbar_align": "left",
|
|
|
|
"check_switcher": False,
|
|
|
|
# "navbar_start": ["navbar-logo", "version-switcher"],
|
|
|
|
# "switcher": {
|
|
|
|
# "json_url": "/_static/switcher.json",
|
|
|
|
# },
|
|
|
|
"show_prev_next": False,
|
|
|
|
"icon_links": [
|
|
|
|
{
|
|
|
|
"name": "Twitter",
|
|
|
|
"url": "https://twitter.com/pyautogen",
|
|
|
|
"icon": "fa-brands fa-twitter",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "GitHub",
|
2024-10-09 10:08:57 -04:00
|
|
|
"url": "https://github.com/microsoft/autogen",
|
2024-09-17 06:22:38 -07:00
|
|
|
"icon": "fa-brands fa-github",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "PyPI",
|
2024-10-09 16:34:39 -04:00
|
|
|
"url": "/autogen/dev/packages",
|
2024-09-17 06:22:38 -07:00
|
|
|
"icon": "fa-custom fa-pypi",
|
|
|
|
},
|
|
|
|
],
|
2024-10-09 10:08:57 -04:00
|
|
|
|
|
|
|
"announcement": 'AutoGen 0.4 is a work in progress. Go <a href="/autogen/0.2/">here</a> to find the 0.2 documentation.',
|
|
|
|
"footer_start": ["copyright"],
|
|
|
|
"footer_center": ["footer-middle-links"],
|
|
|
|
"footer_end": ["theme-version"],
|
|
|
|
"pygments_light_style": "xcode",
|
|
|
|
"pygments_dark_style": "monokai"
|
2024-09-17 06:22:38 -07:00
|
|
|
}
|
|
|
|
|
2024-09-18 10:00:23 -04:00
|
|
|
html_js_files = ["custom-icon.js"]
|
2024-09-17 14:16:13 -04:00
|
|
|
html_sidebars = {
|
|
|
|
"packages/index": [],
|
|
|
|
}
|
2024-09-17 06:22:38 -07:00
|
|
|
|
|
|
|
html_context = {
|
|
|
|
'display_github': True,
|
|
|
|
"github_user": "microsoft",
|
2024-10-09 10:08:57 -04:00
|
|
|
"github_repo": "autogen",
|
2024-09-17 06:22:38 -07:00
|
|
|
"github_version": "main",
|
|
|
|
"doc_path": "python/packages/autogen-core/docs/src/",
|
2024-05-24 13:45:23 -04:00
|
|
|
}
|
2024-06-12 17:10:17 -04:00
|
|
|
|
|
|
|
autodoc_default_options = {
|
|
|
|
"members": True,
|
|
|
|
"undoc-members": True,
|
2024-06-27 13:40:12 -04:00
|
|
|
}
|
|
|
|
|
2024-10-09 14:46:43 -04:00
|
|
|
autodoc_pydantic_model_show_config_summary = False
|
|
|
|
|
2024-08-05 12:27:03 -07:00
|
|
|
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
|
2024-09-17 06:22:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
def setup_to_main(
|
|
|
|
app: Sphinx, pagename: str, templatename: str, context, doctree
|
|
|
|
) -> None:
|
|
|
|
"""Add a function that jinja can access for returning an "edit this page" link pointing to `main`."""
|
|
|
|
|
|
|
|
def to_main(link: str) -> str:
|
|
|
|
"""Transform "edit on github" links and make sure they always point to the main branch.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
link: the link to the github edit interface
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
the link to the tip of the main branch for the same file
|
|
|
|
"""
|
|
|
|
links = link.split("/")
|
|
|
|
idx = links.index("edit")
|
|
|
|
return "/".join(links[: idx + 1]) + "/main/" + "/".join(links[idx + 2:])
|
|
|
|
|
|
|
|
context["to_main"] = to_main
|
|
|
|
|
|
|
|
|
|
|
|
def setup(app: Sphinx) -> Dict[str, Any]:
|
|
|
|
"""Add custom configuration to sphinx app.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
app: the Sphinx application
|
|
|
|
Returns:
|
|
|
|
the 2 parallel parameters set to ``True``.
|
|
|
|
"""
|
|
|
|
app.connect("html-page-context", setup_to_main)
|
|
|
|
|
2024-10-09 14:44:01 -04:00
|
|
|
# Adding here so it is inline and not in a separate file.
|
|
|
|
clarity_analytics = """(function(c,l,a,r,i,t,y){
|
|
|
|
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
|
|
|
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
|
|
|
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
|
|
|
})(window, document, "clarity", "script", "lnxpe6skj1");"""
|
|
|
|
app.add_js_file(None, body=clarity_analytics)
|
|
|
|
|
2024-09-17 06:22:38 -07:00
|
|
|
return {
|
|
|
|
"parallel_read_safe": True,
|
|
|
|
"parallel_write_safe": True,
|
|
|
|
}
|