Skip to content

Commit 9bd1abc

Browse files
committed
DOC: set up document generation
1 parent d9c0548 commit 9bd1abc

29 files changed

+670
-80
lines changed

.github/workflows/docs.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Documentation
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
12+
steps:
13+
- uses: actions/checkout@v5
14+
- name: Set up Python
15+
uses: actions/setup-python@v6
16+
with:
17+
python-version: 3.13
18+
- name: Install dependencies
19+
run: |
20+
set -vxeuo pipefail
21+
pip install .[dev]
22+
pip install .[docs]
23+
python -m pip list
24+
- name: Build Docs
25+
run: |
26+
make -C docs/ html

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS = "-W" # This flag turns warnings into errors.
6+
SPHINXBUILD = sphinx-build
7+
SPHINXPROJ = PackagingScientificPython
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
set SPHINXPROJ=PackagingScientificPython
13+
14+
if "%1" == "" goto help
15+
16+
%SPHINXBUILD% >NUL 2>NUL
17+
if errorlevel 9009 (
18+
echo.
19+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
20+
echo.installed, then set the SPHINXBUILD environment variable to point
21+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
22+
echo.may add the Sphinx directory to PATH.
23+
echo.
24+
echo.If you don't have Sphinx installed, grab it from
25+
echo.http://sphinx-doc.org/
26+
exit /b 1
27+
)
28+
29+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
30+
goto end
31+
32+
:help
33+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
34+
35+
:end
36+
popd

docs/source/api-reference.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
=============
2+
API Reference
3+
=============
4+
5+
.. currentmodule:: save_and_restore_api
6+
7+
Synchronous Communication with Save-And-Restore Server
8+
------------------------------------------------------
9+
10+
.. autosummary::
11+
:nosignatures:
12+
:toctree: generated
13+
14+
SaveRestoreAPI
15+
16+
Authentication
17+
**************
18+
19+
.. autosummary::
20+
:nosignatures:
21+
:toctree: generated
22+
23+
SaveRestoreAPI.auth_gen
24+
SaveRestoreAPI.auth_set
25+
SaveRestoreAPI.auth_clear
26+
27+
Node Controller API
28+
*******************
29+
30+
.. autosummary::
31+
:nosignatures:
32+
:toctree: generated
33+
34+
SaveRestoreAPI.node_get
35+
SaveRestoreAPI.nodes_get
36+
SaveRestoreAPI.node_add
37+
SaveRestoreAPI.node_delete
38+
SaveRestoreAPI.nodes_delete
39+
SaveRestoreAPI.node_get_children
40+
SaveRestoreAPI.node_get_parent
41+
42+
43+
Asynchronous Communication with 0MQ Server
44+
------------------------------------------
45+
46+
.. autosummary::
47+
:nosignatures:
48+
:toctree: generated
49+
50+
aio.SaveRestoreAPI

docs/source/conf.py

Lines changed: 190 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,204 @@
1-
from __future__ import annotations
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Save And Restore API documentation build configuration file, created by
5+
# sphinx-quickstart on Thu Jun 28 12:35:56 2018.
6+
#
7+
# This file is execfile()d with the current directory set to its
8+
# containing dir.
9+
#
10+
# Note that not all possible configuration values are present in this
11+
# autogenerated file.
12+
#
13+
# All configuration values have a default; values that are commented out
14+
# serve to show the default.
215

3-
import importlib.metadata
4-
from typing import Any
16+
# If extensions (or modules to document with autodoc) are in another directory,
17+
# add these directories to sys.path here. If the directory is relative to the
18+
# documentation root, use os.path.abspath to make it absolute, like shown here.
19+
#
20+
# import os
21+
# import sys
22+
# sys.path.insert(0, os.path.abspath('.'))
523

6-
project = "save-and-restore-api"
7-
copyright = "2025, My Name"
8-
author = "My Name"
9-
version = release = importlib.metadata.version("save_and_restore_api")
1024

25+
# -- General configuration ------------------------------------------------
26+
27+
# If your documentation needs a minimal Sphinx version, state it here.
28+
#
29+
# needs_sphinx = '1.0'
30+
31+
# Add any Sphinx extension module names here, as strings. They can be
32+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33+
# ones.
1134
extensions = [
12-
"myst_parser",
13-
"sphinx.ext.autodoc",
14-
"sphinx.ext.intersphinx",
15-
"sphinx.ext.mathjax",
16-
"sphinx.ext.napoleon",
17-
"sphinx_autodoc_typehints",
18-
"sphinx_copybutton",
35+
'sphinx.ext.autodoc',
36+
'sphinx.ext.autosummary',
37+
'sphinx.ext.githubpages',
38+
'sphinx.ext.intersphinx',
39+
'sphinx.ext.mathjax',
40+
'sphinx.ext.viewcode',
41+
'IPython.sphinxext.ipython_directive',
42+
'IPython.sphinxext.ipython_console_highlighting',
43+
# 'matplotlib.sphinxext.plot_directive',
44+
'numpydoc',
1945
]
2046

21-
source_suffix = [".rst", ".md"]
22-
exclude_patterns = [
23-
"_build",
24-
"**.ipynb_checkpoints",
25-
"Thumbs.db",
26-
".DS_Store",
27-
".env",
28-
".venv",
29-
]
47+
# Configuration options for plot_directive. See:
48+
# https://github.com/matplotlib/matplotlib/blob/f3ed922d935751e08494e5fb5311d3050a3b637b/lib/matplotlib/sphinxext/plot_directive.py#L81
49+
plot_html_show_source_link = False
50+
plot_html_show_formats = False
51+
52+
# Generate the API documentation when building
53+
autosummary_generate = True
54+
numpydoc_show_class_members = False
55+
56+
# Add any paths that contain templates here, relative to this directory.
57+
templates_path = ['_templates']
58+
59+
# The suffix(es) of source filenames.
60+
# You can specify multiple suffix as a list of string:
61+
#
62+
# source_suffix = ['.rst', '.md']
63+
# source_suffix = '.rst'
64+
source_suffix = {'.rst': 'restructuredtext'}
65+
66+
# The master toctree document.
67+
master_doc = 'index'
68+
69+
# General information about the project.
70+
project = 'Save And Restore API'
71+
copyright = '2025'
72+
author = 'Contributors'
73+
74+
# The version info for the project you're documenting, acts as replacement for
75+
# |version| and |release|, also used in various other places throughout the
76+
# built documents.
77+
#
78+
import save_and_restore_api
79+
80+
# The short X.Y version.
81+
version = save_and_restore_api.__version__
82+
# The full version, including alpha/beta/rc tags.
83+
release = save_and_restore_api.__version__
84+
85+
# The language for content autogenerated by Sphinx. Refer to documentation
86+
# for a list of supported languages.
87+
#
88+
# This is also used if you do content translation via gettext catalogs.
89+
# Usually you set "language" from the command line for these cases.
90+
language = "en"
3091

31-
html_theme = "furo"
32-
33-
html_theme_options: dict[str, Any] = {
34-
"footer_icons": [
35-
{
36-
"name": "GitHub",
37-
"url": "https://github.com/dmgav/save-and-restore-api",
38-
"html": """
39-
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
40-
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
41-
</svg>
42-
""",
43-
"class": "",
44-
},
45-
],
46-
"source_repository": "https://github.com/dmgav/save-and-restore-api",
47-
"source_branch": "main",
48-
"source_directory": "docs/",
92+
# List of patterns, relative to source directory, that match files and
93+
# directories to ignore when looking for source files.
94+
# This patterns also effect to html_static_path and html_extra_path
95+
exclude_patterns = []
96+
97+
# The name of the Pygments (syntax highlighting) style to use.
98+
pygments_style = 'sphinx'
99+
100+
# If true, `todo` and `todoList` produce output, else they produce nothing.
101+
todo_include_todos = False
102+
103+
104+
# -- Options for HTML output ----------------------------------------------
105+
106+
# The theme to use for HTML and HTML Help pages. See the documentation for
107+
# a list of builtin themes.
108+
#
109+
html_theme = 'sphinx_rtd_theme'
110+
import sphinx_rtd_theme
111+
112+
# html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
113+
114+
# Theme options are theme-specific and customize the look and feel of a theme
115+
# further. For a list of options available for each theme, see the
116+
# documentation.
117+
#
118+
# html_theme_options = {}
119+
120+
# Add any paths that contain custom static files (such as style sheets) here,
121+
# relative to this directory. They are copied after the builtin static files,
122+
# so a file named "default.css" will overwrite the builtin "default.css".
123+
# html_static_path = ['_static']
124+
125+
# Custom sidebar templates, must be a dictionary that maps document names
126+
# to template names.
127+
#
128+
# This is required for the alabaster theme
129+
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
130+
html_sidebars = {
131+
'**': [
132+
'relations.html', # needs 'show_related': True theme option to display
133+
'searchbox.html',
134+
]
49135
}
50136

51-
myst_enable_extensions = [
52-
"colon_fence",
53-
]
54137

55-
intersphinx_mapping = {
56-
"python": ("https://docs.python.org/3", None),
138+
# -- Options for HTMLHelp output ------------------------------------------
139+
140+
# Output file base name for HTML help builder.
141+
htmlhelp_basename = 'save-and-restore-api'
142+
143+
144+
# -- Options for LaTeX output ---------------------------------------------
145+
146+
latex_elements = {
147+
# The paper size ('letterpaper' or 'a4paper').
148+
#
149+
# 'papersize': 'letterpaper',
150+
151+
# The font size ('10pt', '11pt' or '12pt').
152+
#
153+
# 'pointsize': '10pt',
154+
155+
# Additional stuff for the LaTeX preamble.
156+
#
157+
# 'preamble': '',
158+
159+
# Latex figure (float) alignment
160+
#
161+
# 'figure_align': 'htbp',
57162
}
58163

59-
nitpick_ignore = [
60-
("py:class", "_io.StringIO"),
61-
("py:class", "_io.BytesIO"),
164+
# Grouping the document tree into LaTeX files. List of tuples
165+
# (source start file, target name, title,
166+
# author, documentclass [howto, manual, or own class]).
167+
latex_documents = [
168+
(master_doc, 'save-and-restore-api.tex', 'Save And Restore API Documentation',
169+
'Contributors', 'manual'),
62170
]
63171

64-
always_document_param_types = True
172+
173+
# -- Options for manual page output ---------------------------------------
174+
175+
# One entry per manual page. List of tuples
176+
# (source start file, name, description, authors, manual section).
177+
man_pages = [
178+
(master_doc, 'save-and-restore-api', 'Save And Restore API Documentation',
179+
[author], 1)
180+
]
181+
182+
183+
# -- Options for Texinfo output -------------------------------------------
184+
185+
# Grouping the document tree into Texinfo files. List of tuples
186+
# (source start file, target name, title, author,
187+
# dir menu entry, description, category)
188+
texinfo_documents = [
189+
(master_doc, 'save-and-restore-api', 'Save And Restore API Documentation',
190+
author, 'save-and-restore-api', 'Python API for Save And Restore Service',
191+
'Miscellaneous'),
192+
]
193+
194+
195+
196+
197+
# Example configuration for intersphinx: refer to the Python standard library.
198+
intersphinx_mapping = {
199+
'python': ('https://docs.python.org/3/', None),
200+
# 'numpy': ('https://numpy.org/doc/stable/', None),
201+
# 'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
202+
# 'pandas': ('https://pandas.pydata.org/pandas-docs/stable', None),
203+
# 'matplotlib': ('https://matplotlib.org/stable', None),
204+
}

0 commit comments

Comments
 (0)