Skip to content

Commit ad6d8bf

Browse files
speedstorm1copybara-github
authored andcommitted
docs: transition docs workflow to GitHub Actions
PiperOrigin-RevId: 999758960
1 parent 78f6d34 commit ad6d8bf

7 files changed

Lines changed: 2427 additions & 0 deletions

File tree

‎.github/workflows/docs.yml‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Builds the API reference (https://googleapis.github.io/python-genai/) with the
2+
# pinned Sphinx in docs/requirements.txt and publishes it to GitHub Pages.
3+
#
4+
# Run by hand from the Actions tab for now, from main: the github-pages
5+
# environment only accepts deployments from main. Publishing also needs the
6+
# repository's Pages source set to "GitHub Actions"; until then, leave "deploy"
7+
# unchecked to build the site and download it as an artifact.
8+
name: Docs
9+
10+
on:
11+
workflow_dispatch:
12+
inputs:
13+
ref:
14+
description: Tag or branch to build. Tags from before this workflow have no docs/source.
15+
required: true
16+
default: main
17+
deploy:
18+
description: Publish to GitHub Pages
19+
type: boolean
20+
default: false
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
build:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
with:
32+
ref: ${{ inputs.ref }}
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: '3.12'
38+
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install --upgrade pip
42+
pip install -r requirements.txt -r docs/requirements.txt
43+
44+
- name: Build
45+
# The docs import `genai` from the checkout, as build_and_copy_docs.sh
46+
# does from its copy in docs/google. custom.css is copied in first, as
47+
# that script does. The doctree cache goes outside the site, so it is
48+
# not published.
49+
env:
50+
PYTHONPATH: ${{ github.workspace }}/google
51+
run: |
52+
mkdir -p _site/_static/css
53+
cp docs/source/custom.css _site/_static/css/custom.css
54+
sphinx-build -b html -d "$RUNNER_TEMP/doctrees" docs/source _site
55+
56+
- name: Upload the site
57+
uses: actions/upload-pages-artifact@v3
58+
with:
59+
path: _site
60+
61+
deploy:
62+
if: inputs.deploy
63+
needs: build
64+
runs-on: ubuntu-latest
65+
# One deployment at a time; builds can run side by side.
66+
concurrency:
67+
group: pages
68+
cancel-in-progress: false
69+
permissions:
70+
pages: write
71+
id-token: write
72+
environment:
73+
name: github-pages
74+
url: ${{ steps.deployment.outputs.page_url }}
75+
steps:
76+
- name: Publish to GitHub Pages
77+
id: deployment
78+
uses: actions/deploy-pages@v4

‎docs/requirements.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
absl-py==2.1.0
2+
autodoc_pydantic==2.2.0
3+
furo==2025.09.25
4+
myst-parser==4.0.1
5+
sphinx==8.2.3
6+
sphinx-autodoc-typehints==3.2.0

‎docs/source/conf.py‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
project = 'Google Gen AI SDK'
10+
copyright = '2024, Google'
11+
author = 'Google'
12+
13+
# -- General configuration ---------------------------------------------------
14+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
15+
16+
extensions = []
17+
18+
templates_path = ['_templates']
19+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
20+
21+
autoclass_content = 'both'
22+
23+
# -- Options for HTML output -------------------------------------------------
24+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
25+
26+
html_static_path = ['_static']
27+
28+
import html
29+
import os
30+
import sys
31+
sys.path.insert(0, os.path.abspath('.')) # Add current directory to path
32+
sys.path.insert(0, os.path.abspath('../google'))
33+
34+
extensions = ['sphinxcontrib.autodoc_pydantic', 'myst_parser', 'sphinx.ext.autodoc', 'sphinx_autodoc_typehints', 'sphinx.ext.napoleon']
35+
html_theme = 'furo'
36+
37+
TEXT_FONTS = '"Google Sans Text", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif'
38+
CODE_FONTS = 'Roboto Mono, "Helvetica Neue Mono", monospace'
39+
FONT_COLOR_FOR_LIGHT_THEME = 'black'
40+
FONT_COLOR_FOR_DARK_THEME = 'white'
41+
42+
html_theme_options = {
43+
"light_css_variables": {
44+
"font-stack": TEXT_FONTS,
45+
"font-stack--monospace": CODE_FONTS,
46+
"font-stack--headings": TEXT_FONTS,
47+
"color-brand-primary": FONT_COLOR_FOR_LIGHT_THEME,
48+
"color-brand-content": FONT_COLOR_FOR_LIGHT_THEME,
49+
},
50+
"dark_css_variables": {
51+
"font-stack": TEXT_FONTS,
52+
"font-stack--monospace": CODE_FONTS,
53+
"font-stack--headings": TEXT_FONTS,
54+
"color-brand-primary": FONT_COLOR_FOR_DARK_THEME,
55+
"color-brand-content": FONT_COLOR_FOR_DARK_THEME,
56+
},
57+
}
58+
59+
# These folders are copied to the documentation's HTML output
60+
html_static_path = ['_static']
61+
62+
# These paths are either relative to html_static_path
63+
# or fully qualified paths (eg. https://...)
64+
html_css_files = [
65+
'css/custom.css',
66+
]
67+
68+
autodoc_pydantic_model_show_json = True
69+
autodoc_pydantic_model_show_config_summary = False

‎docs/source/custom.css‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@import url('https://fonts.googleapis.com/css?family=Google+Sans:400,500|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700&display=swap');
2+
3+
body {
4+
font-weight: 400;
5+
}
6+
7+
h1 {
8+
font-size: 32px;
9+
font-weight: 400;
10+
}
11+
12+
h2 {
13+
font-size: 24px;
14+
font-weight: 400;
15+
}
16+
17+
h3 {
18+
font-size: 20px;
19+
font-weight: 400;
20+
}
21+
22+
h4 {
23+
font-size: 16px;
24+
font-weight: 400;
25+
}
26+
27+
.sidebar-brand-text {
28+
font-size: 14px;
29+
}
30+
31+
.highlight {
32+
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2);
33+
}

‎docs/source/genai.rst‎

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
Submodules
2+
----------
3+
4+
genai.client module
5+
-------------------
6+
7+
.. automodule:: genai.client
8+
:members:
9+
:undoc-members:
10+
:show-inheritance:
11+
12+
13+
GAOS Client Resources
14+
^^^^^^^^^^^^^^^^^^^^^
15+
16+
The following resource classes are returned by the client properties
17+
``client.interactions``, ``client.agents``, ``client.webhooks``,
18+
``client.triggers``, and ``client.environments``.
19+
20+
.. autoclass:: genai._gaos.google_genai.GeminiNextGenInteractions
21+
:members:
22+
:undoc-members:
23+
:show-inheritance:
24+
25+
.. autoclass:: genai._gaos.google_genai.AsyncGeminiNextGenInteractions
26+
:members:
27+
:undoc-members:
28+
:show-inheritance:
29+
30+
.. autoclass:: genai._gaos.google_genai.GeminiNextGenAgents
31+
:members:
32+
:undoc-members:
33+
:show-inheritance:
34+
35+
.. autoclass:: genai._gaos.google_genai.AsyncGeminiNextGenAgents
36+
:members:
37+
:undoc-members:
38+
:show-inheritance:
39+
40+
.. autoclass:: genai._gaos.google_genai.GeminiNextGenWebhooks
41+
:members:
42+
:undoc-members:
43+
:show-inheritance:
44+
45+
.. autoclass:: genai._gaos.google_genai.AsyncGeminiNextGenWebhooks
46+
:members:
47+
:undoc-members:
48+
:show-inheritance:
49+
50+
.. autoclass:: genai._gaos.google_genai.GeminiNextGenTriggers
51+
:members:
52+
:undoc-members:
53+
:show-inheritance:
54+
55+
.. autoclass:: genai._gaos.google_genai.AsyncGeminiNextGenTriggers
56+
:members:
57+
:undoc-members:
58+
:show-inheritance:
59+
60+
.. autoclass:: genai._gaos.google_genai.GeminiNextGenEnvironments
61+
:members:
62+
:undoc-members:
63+
:show-inheritance:
64+
65+
.. autoclass:: genai._gaos.google_genai.AsyncGeminiNextGenEnvironments
66+
:members:
67+
:undoc-members:
68+
:show-inheritance:
69+
70+
genai.live module
71+
-----------------
72+
73+
.. automodule:: genai.live
74+
:members:
75+
:undoc-members:
76+
:show-inheritance:
77+
78+
genai.models module
79+
-------------------
80+
81+
.. automodule:: genai.models
82+
:members:
83+
:undoc-members:
84+
:show-inheritance:
85+
86+
genai.tokens module
87+
-------------------
88+
89+
.. automodule:: genai.tokens
90+
:members:
91+
:undoc-members:
92+
:show-inheritance:
93+
94+
genai.tunings module
95+
--------------------
96+
97+
.. automodule:: genai.tunings
98+
:members:
99+
:undoc-members:
100+
:show-inheritance:
101+
102+
genai.types module
103+
------------------
104+
105+
.. automodule:: genai.types
106+
:members:
107+
:undoc-members:
108+
:show-inheritance:

0 commit comments

Comments
 (0)