Skip to content

Commit 9b86dcf

Browse files
docs: switch API reference docs to pydata theme (#2237)
* docs: switch API reference docs to pydata theme * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * use python 3.13 to render the docs * deploy to github pages * Revert "🦉 Updates from OwlBot post-processor" This reverts commit 5b5276b. * exclude conf.py from owlbot * remove unneeded replacement --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 4318d66 commit 9b86dcf

File tree

7 files changed

+97
-50
lines changed

7 files changed

+97
-50
lines changed

.github/workflows/docs-deploy.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Deploy docs to GitHub Pages
2+
3+
on:
4+
# Runs on pushes targeting the default branch
5+
# TODO(tswast): Update this to only be releases once we confirm it's working.
6+
push:
7+
branches: ["main"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Build job
26+
build:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
- name: Setup Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: "3.13"
35+
- name: Install nox
36+
run: |
37+
python -m pip install --upgrade setuptools pip wheel
38+
python -m pip install nox
39+
- name: Run docs
40+
run: |
41+
nox -s docs
42+
- name: Upload artifact
43+
uses: actions/upload-pages-artifact@v3
44+
with:
45+
path: docs/_build/html/
46+
47+
# Deployment job
48+
deploy:
49+
environment:
50+
name: github-pages
51+
url: ${{ steps.deployment.outputs.page_url }}
52+
runs-on: ubuntu-latest
53+
needs: build
54+
steps:
55+
- name: Deploy to GitHub Pages
56+
id: deployment
57+
uses: actions/deploy-pages@v4

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Python
1313
uses: actions/setup-python@v5
1414
with:
15-
python-version: "3.10"
15+
python-version: "3.13"
1616
- name: Install nox
1717
run: |
1818
python -m pip install --upgrade setuptools pip wheel

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:orphan:
2+
13
BigQuery DataFrames (BigFrames)
24
===============================
35

docs/conf.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
# All configuration values have a default; values that are commented out
2525
# serve to show the default.
2626

27+
from __future__ import annotations
28+
2729
import os
28-
import shlex
2930
import sys
31+
from typing import Any
3032

3133
# If extensions (or modules to document with autodoc) are in another directory,
3234
# add these directories to sys.path here. If the directory is relative to the
@@ -56,7 +58,7 @@
5658
"sphinx.ext.napoleon",
5759
"sphinx.ext.todo",
5860
"sphinx.ext.viewcode",
59-
"recommonmark",
61+
"myst_parser",
6062
]
6163

6264
# autodoc/autosummary flags
@@ -98,7 +100,7 @@
98100
#
99101
# This is also used if you do content translation via gettext catalogs.
100102
# Usually you set "language" from the command line for these cases.
101-
language = None
103+
language = "en-US"
102104

103105
# There are two options for replacing |today|: either, you set today to some
104106
# non-false value, then it is used:
@@ -148,19 +150,27 @@
148150

149151
# The theme to use for HTML and HTML Help pages. See the documentation for
150152
# a list of builtin themes.
151-
html_theme = "alabaster"
153+
html_theme = "pydata_sphinx_theme"
152154

153155
# Theme options are theme-specific and customize the look and feel of a theme
154156
# further. For a list of options available for each theme, see the
155157
# documentation.
158+
# https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/layout.html#references
156159
html_theme_options = {
157-
"description": "BigQuery DataFrames provides DataFrame APIs on the BigQuery engine",
158-
"github_user": "googleapis",
159-
"github_repo": "python-bigquery-dataframes",
160-
"github_banner": True,
161-
"font_family": "'Roboto', Georgia, sans",
162-
"head_font_family": "'Roboto', Georgia, serif",
163-
"code_font_family": "'Roboto Mono', 'Consolas', monospace",
160+
"github_url": "https://github.com/googleapis/python-bigquery-dataframes",
161+
"logo": {
162+
"text": "BigQuery DataFrames (BigFrames)",
163+
},
164+
"external_links": [
165+
{
166+
"name": "Getting started",
167+
"url": "https://docs.cloud.google.com/bigquery/docs/dataframes-quickstart",
168+
},
169+
{
170+
"name": "User guide",
171+
"url": "https://docs.cloud.google.com/bigquery/docs/bigquery-dataframes-introduction",
172+
},
173+
],
164174
}
165175

166176
# Add any paths that contain custom themes here, relative to this directory.
@@ -264,7 +274,7 @@
264274

265275
# -- Options for LaTeX output ---------------------------------------------
266276

267-
latex_elements = {
277+
latex_elements: dict[str, Any] = {
268278
# The paper size ('letterpaper' or 'a4paper').
269279
#'papersize': 'letterpaper',
270280
# The font size ('10pt', '11pt' or '12pt').
@@ -282,7 +292,7 @@
282292
(
283293
root_doc,
284294
"bigframes.tex",
285-
"bigframes Documentation",
295+
"BigQuery DataFrames (BigFrames)",
286296
author,
287297
"manual",
288298
)
@@ -317,7 +327,7 @@
317327
(
318328
root_doc,
319329
"bigframes",
320-
"bigframes Documentation",
330+
"BigQuery DataFrames (BigFrames)",
321331
[author],
322332
1,
323333
)
@@ -336,7 +346,7 @@
336346
(
337347
root_doc,
338348
"bigframes",
339-
"bigframes Documentation",
349+
"BigQuery DataFrames (BigFrames)",
340350
author,
341351
"bigframes",
342352
"bigframes Library",

noxfile.py

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -515,24 +515,14 @@ def cover(session):
515515
session.run("coverage", "erase")
516516

517517

518-
@nox.session(python=DEFAULT_PYTHON_VERSION)
518+
@nox.session(python="3.13")
519519
def docs(session):
520520
"""Build the docs for this library."""
521521
session.install("-e", ".[scikit-learn]")
522522
session.install(
523-
# We need to pin to specific versions of the `sphinxcontrib-*` packages
524-
# which still support sphinx 4.x.
525-
# See https://github.com/googleapis/sphinx-docfx-yaml/issues/344
526-
# and https://github.com/googleapis/sphinx-docfx-yaml/issues/345.
527-
"sphinxcontrib-applehelp==1.0.4",
528-
"sphinxcontrib-devhelp==1.0.2",
529-
"sphinxcontrib-htmlhelp==2.0.1",
530-
"sphinxcontrib-qthelp==1.0.3",
531-
"sphinxcontrib-serializinghtml==1.1.5",
532-
SPHINX_VERSION,
533-
"alabaster",
534-
"recommonmark",
535-
"anywidget",
523+
"sphinx==8.2.3",
524+
"myst-parser==4.0.1",
525+
"pydata-sphinx-theme==0.16.1",
536526
)
537527

538528
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
@@ -562,19 +552,10 @@ def docfx(session):
562552

563553
session.install("-e", ".[scikit-learn]")
564554
session.install(
565-
# We need to pin to specific versions of the `sphinxcontrib-*` packages
566-
# which still support sphinx 4.x.
567-
# See https://github.com/googleapis/sphinx-docfx-yaml/issues/344
568-
# and https://github.com/googleapis/sphinx-docfx-yaml/issues/345.
569-
"sphinxcontrib-applehelp==1.0.4",
570-
"sphinxcontrib-devhelp==1.0.2",
571-
"sphinxcontrib-htmlhelp==2.0.1",
572-
"sphinxcontrib-qthelp==1.0.3",
573-
"sphinxcontrib-serializinghtml==1.1.5",
574555
SPHINX_VERSION,
575-
"alabaster",
576-
"recommonmark",
577-
"gcp-sphinx-docfx-yaml==3.0.1",
556+
"pydata-sphinx-theme==0.13.3",
557+
"myst-parser==0.18.1",
558+
"gcp-sphinx-docfx-yaml==3.2.4",
578559
"anywidget",
579560
)
580561

@@ -599,7 +580,7 @@ def docfx(session):
599580
"sphinx.ext.napoleon,"
600581
"sphinx.ext.todo,"
601582
"sphinx.ext.viewcode,"
602-
"recommonmark"
583+
"myst_parser"
603584
),
604585
"-b",
605586
"html",

owlbot.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
excludes=[
4545
# Need a combined LICENSE for all vendored packages.
4646
"LICENSE",
47+
"docs/conf.py",
4748
# Multi-processing note isn't relevant, as bigframes is responsible for
4849
# creating clients, not the end user.
4950
"docs/multiprocessing.rst",
@@ -114,13 +115,6 @@
114115
"recursive-include bigframes *.json *.proto *.js *.css py.typed",
115116
)
116117

117-
# Fixup the documentation.
118-
assert 1 == s.replace( # docs/conf.py
119-
["docs/conf.py"],
120-
re.escape("Google Cloud Client Libraries for bigframes"),
121-
"BigQuery DataFrames provides DataFrame APIs on the BigQuery engine",
122-
)
123-
124118
# Don't omit `*/core/*.py` when counting test coverages
125119
assert 1 == s.replace( # .coveragerc
126120
[".coveragerc"],

scripts/publish_api_coverage.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ def generate_pandas_api_coverage():
205205
def generate_sklearn_api_coverage():
206206
"""Explore all SKLearn modules, and for each item contained generate a
207207
regex to detect it being imported, and record whether we implement it"""
208+
209+
import sklearn # noqa
210+
208211
sklearn_modules = [
209212
"sklearn",
210213
"sklearn.model_selection",

0 commit comments

Comments
 (0)