Skip to content
Merged
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
17 changes: 10 additions & 7 deletions .github/workflows/docs-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ on:
push:
branches:
- master
- 'branch-**'
- "branch-**"
paths:
- "docs/**"
- ".github/workflows/docs-pages.yaml"
workflow_dispatch:

jobs:
Expand All @@ -21,13 +22,15 @@ jobs:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Set up env
run: make -C docs setupenv
- name: Install doxygen
run: sudo apt-get update && sudo apt-get install -y doxygen

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "docs/uv.lock"

- name: Build docs
run: make -C docs multiversion
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/docs-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
- master
paths:
- "docs/**"
- ".github/workflows/docs-pr.yaml"
workflow_dispatch:

jobs:
build:
Expand All @@ -19,13 +21,14 @@ jobs:
persist-credentials: false
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: '3.10'
working-directory: docs
enable-cache: true

- name: Set up env
run: make -C docs setupenv
- name: Install doxygen
run: sudo apt-get update && sudo apt-get install -y doxygen

- name: Build docs
run: make -C docs test
22 changes: 8 additions & 14 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Global variables
# You can set these variables from the command line.
POETRY = poetry
UV = uv
SPHINXOPTS = -j auto
SPHINXBUILD = $(POETRY) run sphinx-build
SPHINXBUILD = $(UV) run --frozen sphinx-build
PAPER =
BUILDDIR = _build
SOURCEDIR = source
Expand All @@ -17,20 +17,14 @@ TESTSPHINXOPTS = $(ALLSPHINXOPTS) -W --keep-going
all: dirhtml

# Setup commands
.PHONY: setupenv
setupenv:
pip install -q poetry
sudo apt-get install doxygen

.PHONY: setup
setup:
$(POETRY) install
$(POETRY) update
$(UV) sync
cd .. && doxygen Doxyfile.in

.PHONY: update
update:
$(POETRY) update
$(UV) lock --upgrade

# Clean commands
.PHONY: pristine
Expand Down Expand Up @@ -68,24 +62,24 @@ epub3: setup

.PHONY: multiversion
multiversion: setup
$(POETRY) run sphinx-multiversion source $(BUILDDIR)/dirhtml
$(UV) run --frozen sphinx-multiversion source $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

.PHONY: redirects
redirects: setup
$(POETRY) run redirects-cli fromfile --yaml-file _utils/redirects.yaml --output-dir $(BUILDDIR)/dirhtml
$(UV) run --frozen redirects-cli fromfile --yaml-file _utils/redirects.yaml --output-dir $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

# Preview commands
.PHONY: preview
preview: setup
$(POETRY) run sphinx-autobuild -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml --port 5500 --ignore "*/source/api/*"
$(UV) run --frozen sphinx-autobuild -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml --port 5500 --ignore "*/source/api/*"

.PHONY: multiversionpreview
multiversionpreview: multiversion
$(POETRY) run python -m http.server 5500 --directory $(BUILDDIR)/dirhtml
$(UV) run --frozen python -m http.server 5500 --directory $(BUILDDIR)/dirhtml

# Test commands
.PHONY: test
Expand Down
1,554 changes: 0 additions & 1,554 deletions docs/poetry.lock

This file was deleted.

39 changes: 17 additions & 22 deletions docs/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
[tool.poetry]
name = "cpp-rs-driver"
description = "ScyllaDB CPP RS Driver Documentation"
[project]
name = "cpp-rs-driver-docs"
version = "0.1.0"
authors = ["ScyllaDB Documentation Contributors"]
package-mode = false

[tool.poetry.dependencies]
python = "^3.10"
pygments = "^2.18.0"
sphinx-scylladb-theme = "^1.8.10"
myst-parser = "^3.0.1"
sphinx-autobuild = "^2024.4.19"
Sphinx = "^7.3.7"
sphinx-multiversion-scylla = "^0.3.4"
sphinx-sitemap = "^2.6.0"
redirects_cli = "^0.1.3"
breathe = "4.35.0"
sphinx-scylladb-markdown = "^0.1.2"

[build-system]
requires = ["poetry>=1.8.0"]
build-backend = "poetry.masonry.api"
description = "ScyllaDB CPP RS Driver Documentation"
authors = [{ name = "ScyllaDB Documentation Contributors" }]
requires-python = ">=3.10"
dependencies = [
"pygments>=2.18.0",
"sphinx-scylladb-theme>=1.8.10",
"myst-parser>=3.0.1",
"sphinx-autobuild>=2024.4.19",
"sphinx>=7.3.7",
"sphinx-multiversion-scylla>=0.3.4",
"sphinx-sitemap>=2.6.0",
"redirects-cli>=0.1.3",
"breathe==4.35.0",
"sphinx-scylladb-markdown>=0.1.2",
]
55 changes: 34 additions & 21 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"sphinx_scylladb_theme",
"sphinx_multiversion", # optional
"myst_parser", # optional
'breathe',
'sphinx_scylladb_markdown',
"breathe",
"sphinx_scylladb_markdown",
]

# The suffix(es) of source filenames.
Expand All @@ -55,7 +55,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".venv"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
Expand Down Expand Up @@ -100,43 +100,55 @@


# -- Options for Doxygen (API Reference)
breathe_projects = {
'API': "../../doxygen/xml/"
}
breathe_default_project = 'API'
breathe_default_members = ('members', 'undoc-members')
breathe_projects = {"API": "../../doxygen/xml/"}
breathe_default_project = "API"
breathe_default_members = ("members", "undoc-members")

# Hide parent class names in sidebar
toc_object_entries_show_parents = 'hide'
toc_object_entries_show_parents = "hide"


# Autogenerate API reference
def _generate_structs(outdir, structs, project):
"""Write structs docs in the designated outdir folder"""
for obj in structs:
with open(outdir + '/struct.' + obj + '.rst', 'w') as t_file:
t_file.write(obj + "\n" + "=" * len(obj) + "\n\n" + ".. doxygenstruct:: " + obj +" \n :project: " + project)
with open(outdir + "/struct." + obj + ".rst", "w") as t_file:
t_file.write(
obj
+ "\n"
+ "=" * len(obj)
+ "\n\n"
+ ".. doxygenstruct:: "
+ obj
+ " \n :project: "
+ project
)


def _generate_doxygen_rst(xmldir, outdir):
"""Autogenerate doxygen docs in the designated outdir folder"""
structs = []
files = os.listdir(os.path.join(os.path.dirname(__file__), xmldir))
for file_name in files:
if 'struct' in file_name and '__' not in file_name:
structs.append(file_name
.replace('struct_', '')
.replace('_', ' ')
.replace('.xml','')
.title()
.replace(' ', ''))
if "struct" in file_name and "__" not in file_name:
structs.append(
file_name.replace("struct_", "")
.replace("_", " ")
.replace(".xml", "")
.title()
.replace(" ", "")
)
_generate_structs(outdir, structs, breathe_default_project)


def generate_doxygen(app):
DOXYGEN_XML_DIR = breathe_projects[breathe_default_project]
_generate_doxygen_rst(DOXYGEN_XML_DIR, app.builder.srcdir + '/api')
_generate_doxygen_rst(DOXYGEN_XML_DIR, app.builder.srcdir + "/api")


# -- Options for sitemap extension

sitemap_url_scheme = '/stable/{link}'
sitemap_url_scheme = "/stable/{link}"

# The theme to use for pages.
html_theme = "sphinx_scylladb_theme"
Expand Down Expand Up @@ -168,13 +180,14 @@ def generate_doxygen(app):
htmlhelp_basename = "ScyllaDocumentationdoc"

# URL which points to the root of the HTML documentation.
html_baseurl = 'https://cpp-rs-driver.docs.scylladb.com'
html_baseurl = "https://cpp-rs-driver.docs.scylladb.com"

# Dictionary of values to pass into the template engine’s context for all pages
html_context = {"html_baseurl": html_baseurl}

# -- Initialize Sphinx ----------------------------------------------


def setup(sphinx):
warnings.filterwarnings(
action="ignore",
Expand Down
Loading